• Post Reply Bookmark Topic Watch Topic
  • New Topic

return date for a given week number in a month  RSS feed

 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can someone urgently post a snippet code that will return the date if the week number and the weekday (like wednesday) for a given month in an year is passed.

ex: If I say 2nd wednesday of August in 2004 , it must return the date for second wednesday. URGENT
 
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple. Use a Calendar. Set the YEAR to 2004, MONTH to AUGUST, the DAY_OF_WEEK_IN_MONTH to 2, and the DAY_OF_WEEK to WEDNESDAY. Get the time, done.

If this confuses you, you might want to study the differences between WEEK_OF_MONTH and DAY_OF_WEEK_IN_MONTH.

- Peter
[ August 23, 2004: Message edited by: Peter den Haan ]
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More detail of Calendar

day, month and year are start with ZERO (0) so

day : 0 - 30 (1-31)
month : 0-11 (1-12)
year : 2003 (2004)
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Despite the bugs that might occur, I just developed a small application to clearly see what we have here... Hope this helps...

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!