equivalent Dateserial(),DateAdd() ...

Hello,
Is there any equivalent xojo functions to vb6 DateSerial() and DateAdd() ?

dim d as new Date( 2018, 10, 10 )

const kDays = 60.0 * 60.0 * 24.0
d.TotalSeconds = d.TotalSeconds + ( 2 * kDays )

See:

http://developer.xojo.com/date

[code]
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[/code]

see http://developer.xojo.com/xojo-core-date

[quote=409239:@Kem Tekinay][code]
dim d as new Date( 2018, 10, 10 )

const kDays = 60.0 * 60.0 * 24.0
d.TotalSeconds = d.TotalSeconds + ( 2 * kDays )
[/code]

See:

http://developer.xojo.com/date[/quote]
In Vb6: DateSerial(1967, 2, 31) 03/03/1967 Auto Correct Invalid Date.

Did you try it?

your code return the number of seconds since 1970 i suppose : 3622147200.000000 sec

My code created a Date object. Please look at the developer page I referenced for more information.

I did not found equivalent :
DateAdd(interval, number, date)
interval required (can be second(s),minute(n),hour(h),day(d),month(m),year(yyyy), etc …). The interval you want to add.
number Required.
The number of interval you want to add. Can either be positive, for dates in the future, or negative, for dates in the past.
(Long)
date Required. Variant or literal representing the date to which interval is added.

Understood, with TotalSeconds we can do many date operation like add(),serial(), etc …

again… using new framework you get the notion of intervals

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

[quote=409292:@Jean-Yves Pochez]again… using new framework you get the notion of intervals

[code]
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

This cas gives same date as Date.Now even for min, etc …
[/code][/quote]

[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]