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 orDate.fromString()
by parsing from a String.
There are some extra functions available in the DateTools
class.
In the context of Haxe dates, a timestamp is defined as the number of milliseconds elapsed since 1st January 1970.
Constructor
Methods
getFullYear ():Int
Available on Neko, Flash, macOS, Linux, HTML5, Windows
Returns the full year of this
Date (4-digits).
getMinutes ():Int
Available on Neko, Flash, macOS, Linux, HTML5, Windows
Returns the minutes of this
Date (0-59 range).
getSeconds ():Int
Available on Neko, Flash, macOS, Linux, HTML5, Windows
Returns the seconds of this
Date (0-59 range).
Static methods
staticfromString (s:String):Date
Returns a Date from a formated string s
, with the following accepted
formats:
"YYYY-MM-DD hh:mm:ss"
"YYYY-MM-DD"
"hh:mm:ss"
The first two formats are expressed in local time, the third in UTC Epoch.