Date

@native @JSType trait Date extends StObject

Enables basic storage and retrieval of dates and times.

trait StObject
class Object
trait Any
class Object
trait Matchable
class Any
class Date

Value members

Concrete methods

def getDate(): Double

Gets the day-of-the-month, using local time.

Gets the day-of-the-month, using local time.

def getDay(): Double

Gets the day of the week, using local time.

Gets the day of the week, using local time.

def getFullYear(): Double

Gets the year, using local time.

Gets the year, using local time.

def getHours(): Double

Gets the hours in a date, using local time.

Gets the hours in a date, using local time.

def getMilliseconds(): Double

Gets the milliseconds of a Date, using local time.

Gets the milliseconds of a Date, using local time.

def getMinutes(): Double

Gets the minutes of a Date object, using local time.

Gets the minutes of a Date object, using local time.

def getMonth(): Double

Gets the month, using local time.

Gets the month, using local time.

def getSeconds(): Double

Gets the seconds of a Date object, using local time.

Gets the seconds of a Date object, using local time.

def getTime(): Double

Gets the time value in milliseconds.

Gets the time value in milliseconds.

def getTimezoneOffset(): Double

Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).

Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).

def getUTCDate(): Double

Gets the day-of-the-month, using Universal Coordinated Time (UTC).

Gets the day-of-the-month, using Universal Coordinated Time (UTC).

def getUTCDay(): Double

Gets the day of the week using Universal Coordinated Time (UTC).

Gets the day of the week using Universal Coordinated Time (UTC).

def getUTCFullYear(): Double

Gets the year using Universal Coordinated Time (UTC).

Gets the year using Universal Coordinated Time (UTC).

def getUTCHours(): Double

Gets the hours value in a Date object using Universal Coordinated Time (UTC).

Gets the hours value in a Date object using Universal Coordinated Time (UTC).

def getUTCMilliseconds(): Double

Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).

Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).

def getUTCMinutes(): Double

Gets the minutes of a Date object using Universal Coordinated Time (UTC).

Gets the minutes of a Date object using Universal Coordinated Time (UTC).

def getUTCMonth(): Double

Gets the month of a Date object using Universal Coordinated Time (UTC).

Gets the month of a Date object using Universal Coordinated Time (UTC).

def getUTCSeconds(): Double

Gets the seconds of a Date object using Universal Coordinated Time (UTC).

Gets the seconds of a Date object using Universal Coordinated Time (UTC).

def setDate(date: Double): Double

Sets the numeric day-of-the-month value of the Date object using local time.

Sets the numeric day-of-the-month value of the Date object using local time.

Value Params
date

A numeric value equal to the day of the month.

def setFullYear(year: Double): Double

Sets the year of the Date object using local time.

Sets the year of the Date object using local time.

Value Params
date

A numeric value equal for the day of the month.

month

A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.

year

A numeric value for the year.

def setFullYear(year: Double, month: Double): Double
def setFullYear(year: Double, month: Double, date: Double): Double
def setFullYear(year: Double, month: Unit, date: Double): Double
def setHours(hours: Double): Double

Sets the hour value in the Date object using local time.

Sets the hour value in the Date object using local time.

Value Params
hours

A numeric value equal to the hours value.

min

A numeric value equal to the minutes value.

ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setHours(hours: Double, min: Double): Double
def setHours(hours: Double, min: Double, sec: Double): Double
def setHours(hours: Double, min: Double, sec: Double, ms: Double): Double
def setHours(hours: Double, min: Double, sec: Unit, ms: Double): Double
def setHours(hours: Double, min: Unit, sec: Double): Double
def setHours(hours: Double, min: Unit, sec: Double, ms: Double): Double
def setHours(hours: Double, min: Unit, sec: Unit, ms: Double): Double
def setMilliseconds(ms: Double): Double

Sets the milliseconds value in the Date object using local time.

Sets the milliseconds value in the Date object using local time.

Value Params
ms

A numeric value equal to the millisecond value.

def setMinutes(min: Double): Double

Sets the minutes value in the Date object using local time.

Sets the minutes value in the Date object using local time.

Value Params
min

A numeric value equal to the minutes value.

ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setMinutes(min: Double, sec: Double): Double
def setMinutes(min: Double, sec: Double, ms: Double): Double
def setMinutes(min: Double, sec: Unit, ms: Double): Double
def setMonth(month: Double): Double

Sets the month value in the Date object using local time.

Sets the month value in the Date object using local time.

Value Params
date

A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.

month

A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.

def setMonth(month: Double, date: Double): Double
def setSeconds(sec: Double): Double

Sets the seconds value in the Date object using local time.

Sets the seconds value in the Date object using local time.

Value Params
ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setSeconds(sec: Double, ms: Double): Double
def setTime(time: Double): Double

Sets the date and time value in the Date object.

Sets the date and time value in the Date object.

Value Params
time

A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.

def setUTCDate(date: Double): Double

Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).

Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).

Value Params
date

A numeric value equal to the day of the month.

def setUTCFullYear(year: Double): Double

Sets the year value in the Date object using Universal Coordinated Time (UTC).

Sets the year value in the Date object using Universal Coordinated Time (UTC).

Value Params
date

A numeric value equal to the day of the month.

month

A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.

year

A numeric value equal to the year.

def setUTCFullYear(year: Double, month: Double): Double
def setUTCFullYear(year: Double, month: Double, date: Double): Double
def setUTCFullYear(year: Double, month: Unit, date: Double): Double
def setUTCHours(hours: Double): Double

Sets the hours value in the Date object using Universal Coordinated Time (UTC).

Sets the hours value in the Date object using Universal Coordinated Time (UTC).

Value Params
hours

A numeric value equal to the hours value.

min

A numeric value equal to the minutes value.

ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setUTCHours(hours: Double, min: Double): Double
def setUTCHours(hours: Double, min: Double, sec: Double): Double
def setUTCHours(hours: Double, min: Double, sec: Double, ms: Double): Double
def setUTCHours(hours: Double, min: Double, sec: Unit, ms: Double): Double
def setUTCHours(hours: Double, min: Unit, sec: Double): Double
def setUTCHours(hours: Double, min: Unit, sec: Double, ms: Double): Double
def setUTCHours(hours: Double, min: Unit, sec: Unit, ms: Double): Double
def setUTCMilliseconds(ms: Double): Double

Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).

Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).

Value Params
ms

A numeric value equal to the millisecond value.

def setUTCMinutes(min: Double): Double

Sets the minutes value in the Date object using Universal Coordinated Time (UTC).

Sets the minutes value in the Date object using Universal Coordinated Time (UTC).

Value Params
min

A numeric value equal to the minutes value.

ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setUTCMinutes(min: Double, sec: Double): Double
def setUTCMinutes(min: Double, sec: Double, ms: Double): Double
def setUTCMinutes(min: Double, sec: Unit, ms: Double): Double
def setUTCMonth(month: Double): Double

Sets the month value in the Date object using Universal Coordinated Time (UTC).

Sets the month value in the Date object using Universal Coordinated Time (UTC).

Value Params
date

A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.

month

A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.

def setUTCMonth(month: Double, date: Double): Double
def setUTCSeconds(sec: Double): Double

Sets the seconds value in the Date object using Universal Coordinated Time (UTC).

Sets the seconds value in the Date object using Universal Coordinated Time (UTC).

Value Params
ms

A numeric value equal to the milliseconds value.

sec

A numeric value equal to the seconds value.

def setUTCSeconds(sec: Double, ms: Double): Double
def toDateString(): String

Returns a date as a string value.

Returns a date as a string value.

def toISOString(): String

Returns a date as a string value in ISO format.

Returns a date as a string value in ISO format.

def toJSON(): String

Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

def toJSON(key: Any): String
def toLocaleDateString(): String

Returns a date as a string value appropriate to the host environment's current locale.

Returns a date as a string value appropriate to the host environment's current locale.

def toLocaleDateString(locales: String): String
def toLocaleDateString(locales: String, options: DateTimeFormatOptions): String
def toLocaleDateString(locales: Array[String]): String
def toLocaleDateString(locales: Array[String], options: DateTimeFormatOptions): String
def toLocaleDateString(locales: Unit, options: DateTimeFormatOptions): String
def toLocaleString(locales: String): String
def toLocaleString(locales: String, options: DateTimeFormatOptions): String
def toLocaleString(locales: Array[String]): String
def toLocaleString(locales: Array[String], options: DateTimeFormatOptions): String
def toLocaleString(locales: Unit, options: DateTimeFormatOptions): String
def toLocaleTimeString(): String

Returns a time as a string value appropriate to the host environment's current locale.

Returns a time as a string value appropriate to the host environment's current locale.

def toLocaleTimeString(locales: String): String
def toLocaleTimeString(locales: String, options: DateTimeFormatOptions): String
def toLocaleTimeString(locales: Array[String]): String
def toLocaleTimeString(locales: Array[String], options: DateTimeFormatOptions): String
def toLocaleTimeString(locales: Unit, options: DateTimeFormatOptions): String
def toTimeString(): String

Returns a time as a string value.

Returns a time as a string value.

def toUTCString(): String

Returns a date converted to a string using Universal Coordinated Time (UTC).

Returns a date converted to a string using Universal Coordinated Time (UTC).

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from
Object
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def toLocaleString(): String
Inherited from
Object
def valueOf(): Any
Inherited from
Object

Concrete fields

@JSName
var toPrimitive: Function1[default, String] & Function1[string, String] & Function1[number, Double] & Function1[String, String | Double]

Converts a Date object to a string or number.

Converts a Date object to a string or number.

Value Params
hint

The strings "number", "string", or "default" to specify what primitive to return.

Throws
{TypeError}

If 'hint' was given something other than "number", "string", or "default".