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. final def !=(arg0: scala.Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Date to any2stringadd[Date] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Date, B)
    Implicit
    This member is added by an implicit conversion from Date to ArrowAssoc[Date] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: scala.Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  8. def ensuring(cond: (Date) ⇒ Boolean, msg: ⇒ scala.Any): Date
    Implicit
    This member is added by an implicit conversion from Date to Ensuring[Date] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (Date) ⇒ Boolean): Date
    Implicit
    This member is added by an implicit conversion from Date to Ensuring[Date] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ scala.Any): Date
    Implicit
    This member is added by an implicit conversion from Date to Ensuring[Date] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): Date
    Implicit
    This member is added by an implicit conversion from Date to Ensuring[Date] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: scala.Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  34. 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
  35. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. 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
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. 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
  42. def setDate(date: Double): Unit
  43. def setFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
  44. def setHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  45. def setMilliseconds(ms: Double): Unit
  46. def setMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  47. def setMonth(month: Double, date: Double = getDate()): Unit
  48. def setSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
  49. def setTime(time: Double): Unit
  50. def setUTCDate(date: Double): Unit
  51. def setUTCFullYear(year: Double, month: Double = getMonth(), date: Double = getDate()): Unit
  52. def setUTCHours(hours: Double, min: Double = getMinutes(), sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  53. def setUTCMilliseconds(ms: Double): Unit
  54. def setUTCMinutes(min: Double, sec: Double = getSeconds(), ms: Double = getMilliseconds()): Unit
  55. def setUTCMonth(month: Double, date: Double = getDate()): Unit
  56. def setUTCSeconds(sec: Double, ms: Double = getMilliseconds()): Unit
  57. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  58. def toDateString(): String
  59. def toISOString(): String
  60. def toJSON(): String
  61. def toJSON(key: Any): String
  62. def toLocaleDateString(): String
  63. def toLocaleString(): String
    Definition Classes
    Object
  64. def toLocaleTimeString(): String
  65. def toString(): String
    Definition Classes
    AnyRef → Any
  66. def toTimeString(): String
  67. def toUTCString(): String
  68. def valueOf(): Double
    Definition Classes
    DateObject
  69. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  71. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  72. def [B](y: B): (Date, B)
    Implicit
    This member is added by an implicit conversion from Date to ArrowAssoc[Date] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Date to StringFormat[Date] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from scala.Any

Inherited by implicit conversion any2stringadd from Date to any2stringadd[Date]

Inherited by implicit conversion StringFormat from Date to StringFormat[Date]

Inherited by implicit conversion Ensuring from Date to Ensuring[Date]

Inherited by implicit conversion ArrowAssoc from Date to ArrowAssoc[Date]

Ungrouped