This code does not run properly for those cases : 13/10/2018 + month gives 13/10/2018 !
[code] Using Xojo.Core
Dim twoMonths As New DateInterval
dim minute as New DateInterval
dim second as New DateInterval
dim dy as New DateInterval
twoMonths.Months = 1
dy.Days=29
minute.Minutes =59
second.Seconds = 30
’ Get date two months from today
Dim future As Date = Date.Now + twoMonths
Tdate.text = future.ToText[/code]
What system? Runs fine on macOS, giving 13/11/2018.
AlbertoD
(AlbertoD)
October 13, 2018, 7:41pm
3
You have
twoMonths.Months = 1
then
' Get date two months from today
Dim future As Date = Date.Now + twoMonths
at this point twoMonths equal 1 month, so you will get 1 month from today.
[quote=409746:@Alberto De Poo]You have
twoMonths.Months = 1
then
' Get date two months from today
Dim future As Date = Date.Now + twoMonths
at this point twoMonths equal 1 month, so you will get 1 month from today.[/quote]
OS win 7 , xojo 2015r1 .
AlbertoD
(AlbertoD)
October 14, 2018, 10:07am
5
From http://developer.xojo.com/2015r2-release-notes
Bug Fixes:
38459
Framework » Windows
Adding or subtracting a DateInterval now correctly adds/subtracts months (also fixed for Linux).
I’m sorry your code will not work with 2015r1
My experience with Xojo started with Xojo 20171.1, but I hope this works for you (using classic Xojo Date )
[code]Dim future As New Date
’ Get date two months from today
future.Month = future.Month + 2
Tdate.Text = future.SQLDate[/code]
[quote=409808:@Alberto De Poo]From http://developer.xojo.com/2015r2-release-notes
Bug Fixes:
38459
Framework » Windows
Adding or subtracting a DateInterval now correctly adds/subtracts months (also fixed for Linux).
I’m sorry your code will not work with 2015r1
My experience with Xojo started with Xojo 20171.1, but I hope this works for you (using classic Xojo Date )
[code]Dim future As New Date
’ Get date two months from today
future.Month = future.Month + 2
Tdate.Text = future.SQLDate[/code][/quote]
[code] dim future As New Date
future.Year = future.Year +1
future.Month = future.Month + 1
future.Day = Future.day +17
future.Hour = future.Hour +1
future.minute = future.Minute + 10
Tdate.Text = future.SQLDateTime[/code]
It seems running properly.
Thank’s Alberto.