Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating how many days have passed in a year?
Message
From
02/12/1998 12:47:52
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00163001
Message ID:
00163285
Views:
24
>Is there an easy way to calculate how many days have passed since New Year's? I want to make sure it takes consideration of leap year too.

This should do the job:
STRDAYONE = "{^" + STR(YEAR(YOURDATE)) + "/01/01}"
DAYSELAPSED = 1 + (YOURDATE - &STRDAYONE)
The {^ xx/xx/xx} format was announced for VFP 6, but it works in VFP 5 too; by using it you avoid any SET DATE TO problems.

HTH!
Previous
Reply
Map
View

Click here to load this message in the networking platform