Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Advance datefield by one month
Message
From
17/04/2009 11:07:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01395275
Message ID:
01395279
Views:
73
This message has been marked as a message which has helped to the initial question of the thread.
GOMONTH (ldOldDate, 1)
HTH

>I have a date field and need to advance by one month.
>
>I thought that just adding one month would work and does for dates like
>
>4/15/2009 ........ 5/15/2009
>
>However if i have 3/31/2009 and advance by one month will give me a blank date because there is no 4/31/2009
>if MONTH(ldOldDate) < 12
>   ldNewDate = DATE(YEAR(ldOldDate),MONTH(ldOldDate)+1,DAY(ldOldDate))
>else
>    ldNewDate = DATE(YEAR(ldOldDate)+1,MONTH(1),DAY(ldOldDate))
>endif
Previous
Reply
Map
View

Click here to load this message in the networking platform