To find particular dates depending on frequency

Results 1 to 2 of 2

Thread: To find particular dates depending on frequency

  1. #1
    Join Date
    Dec 1969

    Default To find particular dates depending on frequency

    Hi all,<BR><BR>I have got five dropdown list boxes out of which from the first dropdown the user can select a start date, the second, third and fourth dropdownlists will show the frequncies. <BR><BR>The second dropdown has the values FIRST,SECOND,THIRD,FOURTH,FIFTH. <BR><BR>The third dropdown has the values MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAy,SATURDAY, SUNDAY. <BR><BR>The fourth dropdown has the values WEEKLY, FORTNIGHTLY, MONTHLY.<BR><BR>From the fifth dropdown the user can select the finish date.<BR><BR>For example, if the start date selected by the user is &#039;29/sep/2004&#039; and the finish date is &#039;29/dec/2004&#039;<BR>In the second drop down the value selected is &#039;SECOND&#039;, the value selected in third dropdown is &#039;TUESDAY&#039; and the value selected in fourth dropdown is &#039;FORTNIGHTLY&#039;. If this is the case i have to display all the dates which comes at SECOND TUESDAY FORTNIGHTLY between &#039;29/sep/2004&#039; to &#039;29/dec/2004&#039;. <BR>The dates to be displayed will be &#039;12/oct/2004&#039;,&#039;26.oct/2004&#039;, &#039;9/nov/2004&#039;,&#039;23/nov/2004&#039;, &#039;7/dec/2004&#039; and &#039;21/dec/2004&#039;. Please let me know how i am supposed to get these particular dates between the selected start date and selected finish date for particular frequencies?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: To find particular dates depending on frequenc

    Need to do a loop iteration from the start date to the end date, stepping every frequency looking for the selected day of week. I don&#039;t think this is something that can be written in a few lines. If you&#039;re familiar with dates and working with them, this should be a fairly trivial task...once you overcome the logic behind the loop iteration that is :)<BR><BR>Something like..<BR><BR>[code language="C#"]<BR>for (active_date = start_date;active_date &#060;= end_date; active_date += event_frequency){<BR>if (active_date == desired_day_of_week){<BR>//do something<BR>}<BR>}<BR>[/code]<BR>In a nutshell ;)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts