Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Date
    • NativeDate

Index

Methods

  • [toPrimitive](hint: "default"): string
  • [toPrimitive](hint: "string"): string
  • [toPrimitive](hint: "number"): number
  • [toPrimitive](hint: string): string | number
  • Converts a Date object to a string.

    Parameters

    • hint: "default"

    Returns string

  • Converts a Date object to a string.

    Parameters

    • hint: "string"

    Returns string

  • Converts a Date object to a number.

    Parameters

    • hint: "number"

    Returns number

  • Converts a Date object to a string or number.

    throws

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

    Parameters

    • hint: string

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

    Returns string | number

    A number if 'hint' was "number", a string if 'hint' was "string" or "default".

  • toString(): string
  • Returns a string representation of a date. The format of the string depends on the locale.

    Returns string

  • toDateString(): string
  • Returns a date as a string value.

    Returns string

  • toTimeString(): string
  • Returns a time as a string value.

    Returns string

  • toLocaleString(): string
  • toLocaleString(locales?: string | string[], options?: DateTimeFormatOptions): string
  • Returns a value as a string value appropriate to the host environment's current locale.

    Returns string

  • Converts a date and time to a string by using the current or specified locale.

    Parameters

    • Optional locales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

    • Optional options: DateTimeFormatOptions

      An object that contains one or more properties that specify comparison options.

    Returns string

  • toLocaleDateString(): string
  • toLocaleDateString(locales?: string | string[], options?: DateTimeFormatOptions): string
  • Returns a date as a string value appropriate to the host environment's current locale.

    Returns string

  • Converts a date to a string by using the current or specified locale.

    Parameters

    • Optional locales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

    • Optional options: DateTimeFormatOptions

      An object that contains one or more properties that specify comparison options.

    Returns string

  • toLocaleTimeString(): string
  • toLocaleTimeString(locales?: string | string[], options?: DateTimeFormatOptions): string
  • Returns a time as a string value appropriate to the host environment's current locale.

    Returns string

  • Converts a time to a string by using the current or specified locale.

    Parameters

    • Optional locales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

    • Optional options: DateTimeFormatOptions

      An object that contains one or more properties that specify comparison options.

    Returns string

  • valueOf(): number
  • Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.

    Returns number

  • getTime(): number
  • Gets the time value in milliseconds.

    Returns number

  • getFullYear(): number
  • Gets the year, using local time.

    Returns number

  • getUTCFullYear(): number
  • Gets the year using Universal Coordinated Time (UTC).

    Returns number

  • getMonth(): number
  • Gets the month, using local time.

    Returns number

  • getUTCMonth(): number
  • Gets the month of a Date object using Universal Coordinated Time (UTC).

    Returns number

  • getDate(): number
  • Gets the day-of-the-month, using local time.

    Returns number

  • getUTCDate(): number
  • Gets the day-of-the-month, using Universal Coordinated Time (UTC).

    Returns number

  • getDay(): number
  • Gets the day of the week, using local time.

    Returns number

  • getUTCDay(): number
  • Gets the day of the week using Universal Coordinated Time (UTC).

    Returns number

  • getHours(): number
  • Gets the hours in a date, using local time.

    Returns number

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

    Returns number

  • getMinutes(): number
  • Gets the minutes of a Date object, using local time.

    Returns number

  • getUTCMinutes(): number
  • Gets the minutes of a Date object using Universal Coordinated Time (UTC).

    Returns number

  • getSeconds(): number
  • Gets the seconds of a Date object, using local time.

    Returns number

  • getUTCSeconds(): number
  • Gets the seconds of a Date object using Universal Coordinated Time (UTC).

    Returns number

  • getMilliseconds(): number
  • Gets the milliseconds of a Date, using local time.

    Returns number

  • getUTCMilliseconds(): number
  • Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).

    Returns number

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

    Returns number

  • setTime(time: number): number
  • Sets the date and time value in the Date object.

    Parameters

    • time: number

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

    Returns number

  • setMilliseconds(ms: number): number
  • Sets the milliseconds value in the Date object using local time.

    Parameters

    • ms: number

      A numeric value equal to the millisecond value.

    Returns number

  • setUTCMilliseconds(ms: number): number
  • Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • ms: number

      A numeric value equal to the millisecond value.

    Returns number

  • setSeconds(sec: number, ms?: number): number
  • Sets the seconds value in the Date object using local time.

    Parameters

    • sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setUTCSeconds(sec: number, ms?: number): number
  • Sets the seconds value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setMinutes(min: number, sec?: number, ms?: number): number
  • Sets the minutes value in the Date object using local time.

    Parameters

    • min: number

      A numeric value equal to the minutes value.

    • Optional sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setUTCMinutes(min: number, sec?: number, ms?: number): number
  • Sets the minutes value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • min: number

      A numeric value equal to the minutes value.

    • Optional sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setHours(hours: number, min?: number, sec?: number, ms?: number): number
  • Sets the hour value in the Date object using local time.

    Parameters

    • hours: number

      A numeric value equal to the hours value.

    • Optional min: number

      A numeric value equal to the minutes value.

    • Optional sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number
  • Sets the hours value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • hours: number

      A numeric value equal to the hours value.

    • Optional min: number

      A numeric value equal to the minutes value.

    • Optional sec: number

      A numeric value equal to the seconds value.

    • Optional ms: number

      A numeric value equal to the milliseconds value.

    Returns number

  • setDate(date: number): number
  • Sets the numeric day-of-the-month value of the Date object using local time.

    Parameters

    • date: number

      A numeric value equal to the day of the month.

    Returns number

  • setUTCDate(date: number): number
  • Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • date: number

      A numeric value equal to the day of the month.

    Returns number

  • setMonth(month: number, date?: number): number
  • Sets the month value in the Date object using local time.

    Parameters

    • month: number

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

    • Optional date: number

      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.

    Returns number

  • setUTCMonth(month: number, date?: number): number
  • Sets the month value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • month: number

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

    • Optional date: number

      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.

    Returns number

  • setFullYear(year: number, month?: number, date?: number): number
  • Sets the year of the Date object using local time.

    Parameters

    • year: number

      A numeric value for the year.

    • Optional month: number

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

    • Optional date: number

      A numeric value equal for the day of the month.

    Returns number

  • setUTCFullYear(year: number, month?: number, date?: number): number
  • Sets the year value in the Date object using Universal Coordinated Time (UTC).

    Parameters

    • year: number

      A numeric value equal to the year.

    • Optional month: number

      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.

    • Optional date: number

      A numeric value equal to the day of the month.

    Returns number

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

    Returns string

  • toISOString(): string
  • Returns a date as a string value in ISO format.

    Returns string

  • toJSON(key?: any): string
  • Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

    Parameters

    • Optional key: any

    Returns string

  • parse(s: string): number
  • Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.

    Parameters

    • s: string

      A date string

    Returns number

  • UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number
  • Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.

    Parameters

    • year: number

      The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.

    • monthIndex: number

      The month as a number between 0 and 11 (January to December).

    • Optional date: number

      The date as a number between 1 and 31.

    • Optional hours: number

      Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.

    • Optional minutes: number

      Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.

    • Optional seconds: number

      Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.

    • Optional ms: number

      A number from 0 to 999 that specifies the milliseconds.

    Returns number

  • now(): number
  • Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).

    Returns number

  • Returns VarDate

Constructors

  • new NativeDate(): NativeDate
  • new NativeDate(value: string | number): NativeDate
  • new NativeDate(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): NativeDate
  • new NativeDate(vd: VarDate): NativeDate
  • new NativeDate(value: string | number | Date): NativeDate
  • Returns NativeDate

  • Parameters

    • value: string | number

    Returns NativeDate

  • Creates a new Date.

    Parameters

    • year: number

      The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.

    • monthIndex: number

      The month as a number between 0 and 11 (January to December).

    • Optional date: number

      The date as a number between 1 and 31.

    • Optional hours: number

      Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.

    • Optional minutes: number

      Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.

    • Optional seconds: number

      Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.

    • Optional ms: number

      A number from 0 to 999 that specifies the milliseconds.

    Returns NativeDate

  • Parameters

    Returns NativeDate

  • Parameters

    • value: string | number | Date

    Returns NativeDate

Generated using TypeDoc