Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add or Subtract Whole Years or Months
Message
From
27/05/2004 15:42:19
 
 
To
27/05/2004 15:30:25
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00907917
Message ID:
00907927
Views:
14
>How can I take {^2003/05/27} and add/subtract whole years and months? For example, I want to add 1 year and get {^2004/05/27} or subtract 2 months and get {^2003/03/27}.
>
>Do I need to use DTOC, parse it out, do some math, concantanate it back together and then use CTOD to get it?


Use GoMonth()

or for finer control, convert it to DateTime and add number of seconds:

For 1 year:
? Dtot({^2003/05/27})+(365*24*60*60)


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform