final class Date
The Date class provides a basic structure for date and time related information. Date instances can be created by
new Date()for a specific date,
Date.now()to obtain information about the current time,
Date.fromTime()with a given timestamp or
Date.fromString()by parsing from a String.
There are some extra functions available in the
In the context of Haxe dates, a timestamp is defined as the number of milliseconds elapsed since 1st January 1970 UTC.
Due to platform limitations, only dates in the range 1970 through 2038 are
supported consistently. Some targets may support dates outside this range,
depending on the OS at runtime. The
Date.fromTime method will not work with
timestamps outside the range on any target.
Creates a Date from the formatted string
s. The following formats are
accepted by the function:
The first two formats expressed a date in local time. The third is a time relative to the UTC epoch.
Creates a new date object from the given arguments.
The behaviour of a Date instance is only consistent across platforms if the the arguments describe a valid date.
- month: 0 to 11 (note that this is zero-based)
- day: 1 to 31
- hour: 0 to 23
- min: 0 to 59
- sec: 0 to 59
Returns the timestamp (in milliseconds) of
On cpp and neko, this function only has a second resolution, so the
result will always be a multiple of
To obtain the current timestamp with better precision on cpp and neko,
For measuring time differences with millisecond accuracy on
all platforms, see