From Xojo Documentation

Revision as of 23:03, 13 November 2020 by Gperlman (talk | contribs)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from Object)

Used to store date/time values. Once a date is created, it cannot be modified, but you can create new dates by applying a DateInterval to an existing date.

Day fa-lock-32.png Minute fa-lock-32.png SecondsFrom1970 fa-lock-32.png
DayOfWeek fa-lock-32.png Month fa-lock-32.png TimeZone fa-lock-32.png
DayOfYear fa-lock-32.png Nanosecond fa-lock-32.png Year fa-lock-32.png
Hour fa-lock-32.png Second fa-lock-32.png
Shared Methods
FromText Now
Add Subtract

Constructor(secondsFrom1970 As Double, timezone As TimeZone)

Constructor(year As Integer, month As Integer, day As Integer, hour As Integer = 0, minute As Integer = 0, seconds As Integer = 0, nanoseconds As Integer = 0, timezone As TimeZone)


Xojo.Core.Date uses ICU (International Components for Unicode) for its date handling, supporting dates starting from 0001-Jan-01 and switching between Julian and Gregorian calendars on 1582-Oct-04.

You cannot use Dim d As New Date to get the current date. Instead, use Dim d As Date = Date.Now or more simply, just Date.Now.

To compare dates, use the SecondsFrom1970 property:

If myDate.SecondsFrom1970 > yourDate.SecondsFrom1970 Then
// myDate is greater than yourDate
End If

See Also

Xojo.Core.DateInterval, Xojo.Core.TimeZone, Date classes