Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need last day of month, 2nd wednesday ...stuff like that
Message
From
30/10/2003 17:53:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00844758
Message ID:
00844762
Views:
22
No, I haven't done this already, but I'll see whether I can help.

>I need some fancy date functions....
>First, I need to know the last day of a givin month...

You can go to the first of the next month, and subtract one. For instance, for month 5, 2003, you can use date(2003, 5+1, 1) - 1. Additional adjustments are required for month 12.

>Then I also need to be able to determine the 1st, 2nd, 3rd, 4th, last [monday, tuesday, whatever] day of the month.
>In other words, the user would select the 4th Thurday of Oct, 2003 - I need a way to know that is Thurday Oct 23, 2003.

I would just loop through the first days of the month, until you find a Thursday. Then, to get the 4th. Thursday, add 7 * (4-1) days.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform