Xojo.Core.DateInterval

Hi everybody,

I try to understand how ‘DateInterval’ works.

I put the example below in a Pushbutton :

[code]Dim d As Date = Date.Now

Dim di As New DateInterval
di.Months = 2 // 2 months

// Get date two months from today
Dim d2 As Date = d + di

// Get date two months before today
Dim d3 As Date = d - di[/code]

Of course Xojo compiler indicates :

[quote]This item does not exist
Dim d As Date = Date.Now[/quote]

Someone would be kind enough to tell me how to access this class, step by step ?

Thanx.

[quote=212078:@Stephane REVILLARD]Hi everybody,

I try to understand how ‘DateInterval’ works.

I put the example below in a Pushbutton :

[code]Dim d As Date = Date.Now

Dim di As New DateInterval
di.Months = 2 // 2 months

// Get date two months from today
Dim d2 As Date = d + di

// Get date two months before today
Dim d3 As Date = d - di[/code]

Of course Xojo compiler indicates :

Someone would be kind enough to tell me how to access this class, step by step ?

Thanx.[/quote]

If you are trying that in a Desktop project, you want to put

Using Xojo.Core

before the snippet, so Xojo uses the new framework.

Otherwise, you need to put the namespace before the classes (as it appears on top of the Dev Center page http://developer.xojo.com/xojo-core-dateinterval) :

[code] Dim d As Xojo.Core.Date = Xojo.Core.Date.Now

Dim di As New Xojo.Core.DateInterval
di.Months = 2 // 2 months

// Get date two months from today
Dim d2 As Xojo.Core.Date = d + di

// Get date two months before today
Dim d3 As Xojo.Core.Date = d - di[/code]

Hi Michel,

Thank you for your answer.

I just found out why it was not working : My Xojo version is 2014r2 and Xojo.Core.DateInterval doesn’t exist.

Regards.