Date

js.lib.Date (extern class)

Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.

Static Members

fromHaxeDate(date: _Date.HaxeDate): Date

Cast Haxe's Date to js.lib.Date.

Name Type
date _Date.HaxeDate
Returns
Date

toHaxeDate(date: Date): _Date.HaxeDate

Cast js.lib.Date to Haxe's Date.

Name Type
date Date
Returns
_Date.HaxeDate

now(): Float

Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC, with leap seconds ignored

Returns
Float

parse(str: String): Float

Parses a string representation of a date and returns the number of milliseconds since 1 January, 1970, 00:00:00, UTC, with leap seconds ignored.

Name Type
str String
Returns
Float

UTC(year: Int, month: Int, ?day: Int, ?hours: Int, ?minutes: Int, ?seconds: Int, ?milliseconds: Int): Float

Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC, with leap seconds ignored.

Name Type Default
year Int
month Int
day Int (optional)
hours Int (optional)
minutes Int (optional)
seconds Int (optional)
milliseconds Int (optional)
Returns
Float

Instance Members

getDate(): Int

Returns the day of the month (1-31) for the specified date according to local time.

Returns
Int

getDay(): Int

Returns the day of the week (0-6) for the specified date according to local time.

Returns
Int

getFullYear(): Int

Returns the year (4 digits for 4-digit years) of the specified date according to local time.

Returns
Int

getHours(): Int

Returns the hour (0-23) in the specified date according to local time.

Returns
Int

getMilliseconds(): Int

Returns the milliseconds (0-999) in the specified date according to local time.

Returns
Int

getMinutes(): Int

Returns the minutes (0-59) in the specified date according to local time.

Returns
Int

getMonth(): Int

Returns the month (0-11) in the specified date according to local time.

Returns
Int

getSeconds(): Int

Returns the seconds (0-59) in the specified date according to local time.

Returns
Int

getTime(): Float

Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times).

Returns
Float

getTimezoneOffset(): Int

Returns the time-zone offset in minutes for the current locale.

Returns
Int

getUTCDate(): Int

Returns the day (date) of the month (1-31) in the specified date according to universal time.

Returns
Int

getUTCDay(): Int

Returns the day of the week (0-6) in the specified date according to universal time.

Returns
Int

getUTCFullYear(): Int

Returns the year (4 digits for 4-digit years) in the specified date according to universal time.

Returns
Int

getUTCHours(): Int

Returns the hours (0-23) in the specified date according to universal time.

Returns
Int

getUTCMilliseconds(): Int

Returns the milliseconds (0-999) in the specified date according to universal time.

Returns
Int

getUTCMinutes(): Int

Returns the minutes (0-59) in the specified date according to universal time.

Returns
Int

getUTCMonth(): Int

Returns the month (0-11) in the specified date according to universal time.

Returns
Int

getUTCSeconds(): Int

Returns the seconds (0-59) in the specified date according to universal time.

Returns
Int

setDate(value: Int): Void

Sets the day of the month for a specified date according to local time.

Name Type
value Int

setFullYear(value: Int): Void

Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to local time.

Name Type
value Int

setHours(value: Int): Void

Sets the hours for a specified date according to local time.

Name Type
value Int

setMilliseconds(value: Int): Void

Sets the milliseconds for a specified date according to local time.

Name Type
value Int

setMinutes(value: Int): Void

Sets the minutes for a specified date according to local time.

Name Type
value Int

setMonth(value: Int): Void

Sets the month for a specified date according to local time.

Name Type
value Int

setSeconds(value: Int): Void

Sets the seconds for a specified date according to local time.

Name Type
value Int

setTime(value: Float): Void

Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior.

Name Type
value Float

setUTCDate(value: Int): Void

Sets the day of the month for a specified date according to universal time.

Name Type
value Int

setUTCFullYear(value: Int): Void

Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to universal time.

Name Type
value Int

setUTCHours(value: Int): Void

Sets the hour for a specified date according to universal time.

Name Type
value Int

setUTCMilliseconds(value: Int): Void

Sets the milliseconds for a specified date according to universal time.

Name Type
value Int

setUTCMinutes(value: Int): Void

Sets the minutes for a specified date according to universal time.

Name Type
value Int

setUTCMonth(value: Int): Void

Sets the month for a specified date according to universal time.

Name Type
value Int

setUTCSeconds(value: Int): Void

Sets the seconds for a specified date according to universal time.

Name Type
value Int

toDateString(): String

Returns the "date" portion of the Date as a human-readable string.

Returns
String

toISOString(): String

Converts a date to a string following the ISO 8601 Extended Format.

Returns
String

toJSON(): String

Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify().

Returns
String

toLocaleDateString(?locales: String, ?options: Dynamic): String

Returns a string with a locality sensitive representation of the date portion of this date based on system settings.

Name Type Default
locales String (optional)
options Dynamic (optional)
Returns
String

toLocaleFormat(format: String): String

Converts a date to a string, using a format string.

Name Type
format String
Returns
String

toLocaleString(?locales: String, ?options: Dynamic): String

Returns a string with a locality sensitive representation of this date. Overrides the Object.prototype.toLocaleString() method.

Name Type Default
locales String (optional)
options Dynamic (optional)
Returns
String

toLocaleTimeString(?locales: String, ?options: Dynamic): String

Returns a string with a locality sensitive representation of the time portion of this date based on system settings.

Name Type Default
locales String (optional)
options Dynamic (optional)
Returns
String

toSource(): String

Returns a string representing the source for an equivalent Date object; you can use this value to create a new object. Overrides the Object.prototype.toSource() method.

Returns
String

toString(): String

Returns a string representing the specified Date object. Overrides the Object.prototype.toString() method.

Returns
String

toTimeString(): String

Returns the "time" portion of the Date as a human-readable string.

Returns
String

toUTCString(): String

Converts a date to a string using the UTC timezone.

Returns
String

new(): Void