Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding 1 year to a date
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430291
Message ID:
00430584
Views:
12
>>Close, but no cigar. GOMONTH(DATE(2000, 2, 29), 12) returns 02/28/2001. This returns 3/1/2001.
>
>Hmmmm, so you're going to side with GoMonth on this one, huh? :-)
>
>I think it makes more sense to go to 3/1. If we use logic, isn't:
>
>"A year after 2/29"
>
>equal to:
>
>"A year and a day after the day before 2/29"
>
>?
>That would be 2/29 sometimes, 3/1 others :-)

I think the logic would involve both month and day. IOW, one year from now has to be of the same month. So a year from any date in February has to be in February.

>The real problem is trying to go multiple years with teh 366, 365 thing.

Yep! I should point out that my assignment that I spoke of earlier was in BASICA, so no GOMONTH() or any of the other lovely date functions that VFP has. It really wasn't so hard. Basically, the calculations simply did modulus arithemtic (365 % 7 = 1). So when non-leap years are involved, calculating the date/day of week, simply involves adding one to the current day of the week. I've haven't checked this with a calendar (yet), but I'll bet cold, hard cash that October 17, 2001 is a Wednesday.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform