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:
00430817
Views:
9
>>>>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.
>
>Hi George,
>
>What about October 17, 3001? How would you check it? :)

Seriously, you could. Off the top of my head, I'd say it's a Friday. Caluation would be (1000 + 241) % 7 = 2. 1000 for a thousand years plus an addition 241 for leap years. It would then occur two days of the week later than 10/17/2001 or Friday. Now I'll check use VFP. Nope Saturday. I probably miscalcuated the number of leap years between the two dates. Lesse, nope, 242 leap years.

>A little joke: (translated from Russian)
>One englishman was asked about his plans on 3rd millenium.
>He said: "I don't have ambitions on it. The most part of it I would be dead"...

< s >
George

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

Click here to load this message in the networking platform