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
DateToolsclass.In the context of Haxe dates, a timestamp is defined as the number of milliseconds elapsed since 1st January 1970.
new (year:Int, month:Int, day:Int, hour:Int, min:Int, sec:Int)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.
getDate ():IntReturns the day of this Date (1-31 range).
getDay ():IntReturns the day of the week of this Date (0-6 range) where 0 is Sunday.
getFullYear ():IntReturns the full year of this Date (4-digits).
getHours ():IntReturns the hours of this Date (0-23 range).
getMinutes ():IntReturns the minutes of this Date (0-59 range).
getMonth ():IntReturns the month of this Date (0-11 range).
getSeconds ():IntReturns the seconds of this Date (0-59 range).
getTime ():FloatReturns the timestamp (in milliseconds) of the date. It might only have a per-second precision depending on the platforms.
toString ():StringReturns a string representation of this Date, by using the standard format [YYYY-MM-DD HH:MM:SS]. See DateTools.format for other formating rules.
static fromString (s:String):DateReturns 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.
static fromTime (t:Float):DateReturns a Date from timestamp t.
static now ():DateReturns a Date representing the current local time.
© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/Date.html