Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating date from day of year
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00673489
Message ID:
00673490
Views:
15
This message has been marked as the solution to the initial question of the thread.
>I have the day of the year and need to calculate the date. What is the best way to do this?
>
>I found this code to calculate the day of year - but nothing to reverse the day of year to a date.
>
>lnDays = ldMyDate - gomonth(ldMyDate, - month(ldMyDate) + 1) + day(ldMyDate)
>
>I'm sure I could set up a case statement for all the months and all the leap years. I was looking for a quickie!!
>

Try
ldDate = DATE(lnYear-1, 12, 31) + lnDays  
* or
ldDate = DATE(lnYear, 01, 01) + ( lnDays - 1 )
Whichever you prefer.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform