Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Advance datefield by one month
Message
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:
01395278
Views:
109
This message has been marked as the solution to the initial question of the thread.
See GOMONTH() function
ldNewDate = GOMONTH(ldOldDate,1)
>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
>
>
>Any suggestion to accomplish this would be appreciated.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform