Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating how many days have passed in a year?
Message
From
01/12/1998 18:11:39
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00163001
Message ID:
00163018
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.

Yes, as a matter of fact there is. The Julian date is the number of days since a fixed point in history ... 14 September 1752 to be precise. Two VFOX functions will give you what you want.

Sys(11) Returns the Julian number of a specific date.

Sys(11,"01/01/98") Returns the Julian day number of January 1, 1998

Sys(1) Returns the Juilian number of the system date.

** Note both of these functions return the number as a character string so to get the number of days since the beginning of the year ...

nDays = Val(Sys(11,"01/01/98")) - Val(Sys(1))

Regards,

Jason Tryon
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Previous
Reply
Map
View

Click here to load this message in the networking platform