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:
00430819
Views:
12
>>>>I need to add 1 or more year to the start date in a lease application. I use dStartdate + 365 but it does not work for leap years. I coul do something like YEAR(dStartdate) MOD 4 but I was wandering if there was not a simpler method.
>>>
>>>If someone doesn't have VFP 6, you could do:
>>>
>>>?date(year(date()) + 1, month(date()), day(date()))
>>
>>GOMONTH() has been around since FPD 2.5 at least. DATE() with numeric parameters didn't appear until VFP 6.0.
>
>And GOMONTH() still does not work correctly. ;(
>Try following lines:
>
>SET STRICTDATE TO 0
>tt = {01/01/0003}
>? tt && shows correct date - 01/01/0003
>? gomonth(tt,12) && shows empty date - \ \
>
>GOMONTH() have such behaviour up to {01/01/1752}
>How do you like this bug? ;)

Vlad,

This is pretty well known. I have a feeling that it's tied to the adoption of the Gregorian calendar in the US. I mentioned Zoeller's (or Zeller, I'm not sure which) Congruence earlier. If that's used, I believe it doesn't work prior to the year used as the base for the adoption of the Gregorian calendar. 'Course, this is strictly off the top of my head (haven't dealt with the formula since 1986).
George

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

Click here to load this message in the networking platform