How can I sum a date with some amount of days?
Example:
I have a date in a string variable like “01/03/16” (DD/MM/YY), and I’d like to sum with 25 days or 45 days or 30 days. What I should do?
Thanks in advance,
Alexandre
How can I sum a date with some amount of days?
Example:
I have a date in a string variable like “01/03/16” (DD/MM/YY), and I’d like to sum with 25 days or 45 days or 30 days. What I should do?
Thanks in advance,
Alexandre
Reading the Lang Ref in regards to the Date Object type would have pointed you in the proper direction
dim dt as new date
dt.sqldate="2016-01-03"
dt.day=dt.day+25 // or 45 or 30
[quote=248613:@ALEXANDRE SANGALO]How can I sum a date with some amount of days?
Example:
I have a date in a string variable like “01/03/16” (DD/MM/YY), and I’d like to sum with 25 days or 45 days or 30 days. What I should do?
Thanks in advance,
Alexandre[/quote]
In addition to Dave’s answer (which was absolutely spot on) the new Xojo.Core.Date class object has a few nice new features for adding dates using the Xojo.Core.DateInterval.
This example is from the LR:
http://developer.xojo.com/xojo-core-date
Using Xojo.Core
Dim twoMonths As New DateInterval
twoMonths.Months = 2 ' 2 month interval
' Get date two months from today
Dim future As Date = Date.Now + twoMonths
Just to have as another option since I just learned of this operator a few weeks ago.
HTH
Thanks a lot to everybody!