class Date extends Object
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.
MDN
- Annotations
- @JSType() @native() @JSGlobal()
- Note
js.Date
objects can represent an *invalid date*, for example, if they are constructed from aString
that cannot be parsed as a date. Most methods of such ajs.Date
will returnNaN
(for those returning aDouble
) or other invalid values.
- Alphabetic
- By Inheritance
- Date
- Object
- Any
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
Value Members
-
def
getDate(): Double
Returns the day of the month (1-31) for the specified date according to local time.
Returns the day of the month (1-31) for the specified date according to local time.
MDN
-
def
getDay(): Double
Returns the day of the week (0-6) for the specified date according to local time.
Returns the day of the week (0-6) for the specified date according to local time.
MDN
-
def
getFullYear(): Double
Returns the year (4 digits for 4-digit years) of the specified date according to local time.
Returns the year (4 digits for 4-digit years) of the specified date according to local time.
MDN
-
def
getHours(): Double
Returns the hour (0-23) in the specified date according to local time.
Returns the hour (0-23) in the specified date according to local time.
MDN
-
def
getMilliseconds(): Double
Returns the milliseconds (0-999) in the specified date according to local time.
Returns the milliseconds (0-999) in the specified date according to local time.
MDN
-
def
getMinutes(): Double
Returns the minutes (0-59) in the specified date according to local time.
Returns the minutes (0-59) in the specified date according to local time.
MDN
-
def
getMonth(): Double
Returns the month (0-11) in the specified date according to local time.
Returns the month (0-11) in the specified date according to local time.
MDN
-
def
getSeconds(): Double
Returns the seconds (0-59) in the specified date according to local time.
Returns the seconds (0-59) in the specified date according to local time.
MDN
-
def
getTime(): Double
Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC.
Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC. (Negative values are returned for prior times).
MDN
-
def
getTimezoneOffset(): Double
Returns the time-zone offset in minutes for the current locale.
Returns the time-zone offset in minutes for the current locale.
MDN
-
def
getUTCDate(): Double
Returns the day (date) of the month (1-31) in the specified date according to universal time.
Returns the day (date) of the month (1-31) in the specified date according to universal time.
MDN
-
def
getUTCDay(): Double
Returns the day of the week (0-6) in the specified date according to universal time.
Returns the day of the week (0-6) in the specified date according to universal time. MDN
-
def
getUTCFullYear(): Double
Returns the year (4 digits for 4-digit years) in the specified date according to universal time.
Returns the year (4 digits for 4-digit years) in the specified date according to universal time.
MDN
-
def
getUTCHours(): Double
Returns the hours (0-23) in the specified date according to universal time.
Returns the hours (0-23) in the specified date according to universal time.
MDN
-
def
getUTCMilliseconds(): Double
Returns the milliseconds (0-999) in the specified date according to universal time.
Returns the milliseconds (0-999) in the specified date according to universal time.
MDN
-
def
getUTCMinutes(): Double
Returns the minutes (0-59) in the specified date according to universal time.
Returns the minutes (0-59) in the specified date according to universal time.
MDN
-
def
getUTCMonth(): Double
Returns the month (0-11) in the specified date according to universal time.
Returns the month (0-11) in the specified date according to universal time.
MDN
-
def
getUTCSeconds(): Double
Returns the seconds (0-59) in the specified date according to universal time.
Returns the seconds (0-59) in the specified date according to universal time.
MDN
-
def
hasOwnProperty(v: String): Boolean
Tests whether this object has the specified property as a direct property.
Tests whether this object has the specified property as a direct property.
Unlike js.Object.hasProperty, this method does not check down the object's prototype chain.
MDN
- Definition Classes
- Object
-
def
isPrototypeOf(v: Object): Boolean
Tests whether this object is in the prototype chain of another object.
Tests whether this object is in the prototype chain of another object.
- Definition Classes
- Object
-
def
propertyIsEnumerable(v: String): Boolean
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
If the object does not have the specified property, this method returns false.
MDN
- Definition Classes
- Object
- def setDate(date: Double): Unit
- def setFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
- def setHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
- def setMilliseconds(ms: Double): Unit
- def setMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
- def setMonth(month: Double, date: Double = getDate()): Unit
- def setSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
- def setTime(time: Double): Unit
- def setUTCDate(date: Double): Unit
- def setUTCFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
- def setUTCHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
- def setUTCMilliseconds(ms: Double): Unit
- def setUTCMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
- def setUTCMonth(month: Double, date: Double = getDate()): Unit
- def setUTCSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
- def toDateString(): String
- def toISOString(): String
- def toJSON(): String
- def toJSON(key: Any): String
- def toLocaleDateString(): String
-
def
toLocaleString(): String
- Definition Classes
- Object
- def toLocaleTimeString(): String
- def toTimeString(): String
- def toUTCString(): String
- def valueOf(): Double