Packages

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 a String that cannot be parsed as a date. Most methods of such a js.Date will return NaN (for those returning a Double) or other invalid values.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Date
  2. Object
  3. Any
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Date(year: Int, month: Int, date: Int = 1, hours: Int = 0, minutes: Int = 0, seconds: Int = 0, ms: Int = 0)
  2. new Date(value: String)
  3. new Date(value: Double)
  4. new Date()

Value Members

  1. 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

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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
  20. 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
  21. 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
  22. def setDate(date: Double): Unit
  23. def setFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
  24. def setHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  25. def setMilliseconds(ms: Double): Unit
  26. def setMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  27. def setMonth(month: Double, date: Double = getDate()): Unit
  28. def setSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
  29. def setTime(time: Double): Unit
  30. def setUTCDate(date: Double): Unit
  31. def setUTCFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
  32. def setUTCHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  33. def setUTCMilliseconds(ms: Double): Unit
  34. def setUTCMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  35. def setUTCMonth(month: Double, date: Double = getDate()): Unit
  36. def setUTCSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
  37. def toDateString(): String
  38. def toISOString(): String
  39. def toJSON(): String
  40. def toJSON(key: Any): String
  41. def toLocaleDateString(): String
  42. def toLocaleString(): String
    Definition Classes
    Object
  43. def toLocaleTimeString(): String
  44. def toTimeString(): String
  45. def toUTCString(): String
  46. def valueOf(): Double
    Definition Classes
    DateObject