[]
        
(Showing Draft Content)

DateTime Class

DateTime Class

Provides date and time utilities.

Heirarchy

  • DateTime

Methods

Static addDays

  • addDays(value: Date, days: number): Date
  • Gets a new Date that adds the specified number of days to a given Date.

    Parameters

    • value: Date

      Original date.

    • days: number

      Number of days to add to the given date.

    Returns Date

Static addHours

  • addHours(value: Date, hours: number): Date
  • Gets a new Date that adds the specified number of hours to a given Date.

    Parameters

    • value: Date

      Original date.

    • hours: number

      Number of hours to add to the given date.

    Returns Date

Static addMinutes

  • addMinutes(value: Date, minutes: number): Date
  • Gets a new Date that adds the specified number of minutes to a given Date.

    Parameters

    • value: Date

      Original date.

    • minutes: number

      Number of minutes to add to the given date.

    Returns Date

Static addMonths

  • addMonths(value: Date, months: number): Date
  • Gets a new Date that adds the specified number of months to a given Date.

    Parameters

    • value: Date

      Original date.

    • months: number

      Number of months to add to the given date.

    Returns Date

Static addSeconds

  • addSeconds(value: Date, seconds: number): Date
  • Gets a new Date that adds the specified number of seconds to a given Date.

    Parameters

    • value: Date

      Original date.

    • seconds: number

      Number of seconds to add to the given date.

    Returns Date

Static addYears

  • addYears(value: Date, years: number): Date
  • Gets a new Date that adds the specified number of years to a given Date.

    Parameters

    • value: Date

      Original date.

    • years: number

      Number of years to add to the given date.

    Returns Date

Static clone

  • clone(date: Date): Date
  • Creates a copy of a given Date object.

    Parameters

    • date: Date

      Date object to copy.

    Returns Date

Static equals

  • equals(d1: Date | null, d2: Date | null): boolean
  • Returns true if two Date objects refer to the same date and time (or if both are null).

    Parameters

    • d1: Date | null

      First date.

    • d2: Date | null

      Second date.

    Returns boolean

Static fromDateTime

  • fromDateTime(date: Date, time: Date): Date
  • Gets a Date object with the date and time set on two Date objects.

    Parameters

    • date: Date

      Date object that contains the date (day/month/year).

    • time: Date

      Date object that contains the time (hour:minute:second.millisecond).

    Returns Date

Static fromFiscal

  • fromFiscal(date: Date, govt: boolean): Date
  • Converts a fiscal year date to a calendar date using the current culture.

    Parameters

    • date: Date

      Fiscal year date.

    • govt: boolean

      Whether to use the government or corporate fiscal year.

    Returns Date

Static monthFirst

  • monthFirst(value: Date): Date
  • Gets the first day of the month for a given Date.

    Parameters

    • value: Date

      Original date.

    Returns Date

Static monthLast

  • monthLast(value: Date): Date
  • Gets the last day of the month for a given Date.

    Parameters

    • value: Date

      Original date.

    Returns Date

Static newDate

  • newDate(year?: number, month?: number, day?: number, hour?: number, min?: number, sec?: number, ms?: number): Date
  • Gets a new Date object instance.

    Parameters

    • Optional year: number

      Integer value representing the year, defaults to current year.

    • Optional month: number

      Integer value representing the month (0-11), defaults to current month.

    • Optional day: number

      Integer value representing the day (1-31), defaults to current day.

    • Optional hour: number

      Integer value representing the hour, defaults to zero.

    • Optional min: number

      Integer value representing the minute, defaults to zero.

    • Optional sec: number

      Integer value representing the second, defaults to zero.

    • Optional ms: number

      Integer value representing the millisecond, defaults to zero.

    Returns Date

Static sameDate

  • sameDate(d1: Date, d2: Date): boolean
  • Returns true if two Date objects refer to the same date (ignoring time).

    Parameters

    • d1: Date

      First date.

    • d2: Date

      Second date.

    Returns boolean

Static sameTime

  • sameTime(d1: Date, d2: Date): boolean
  • Returns true if two Date objects refer to the same time (ignoring date).

    Parameters

    • d1: Date

      First date.

    • d2: Date

      Second date.

    Returns boolean

Static toFiscal

  • toFiscal(date: Date, govt: boolean): Date
  • Converts a calendar date to a fiscal date using the current culture.

    Parameters

    • date: Date

      Calendar date.

    • govt: boolean

      Whether to use the government or corporate fiscal year.

    Returns Date

Static weekFirst

  • weekFirst(value: Date, firstDayOfWeek?: number): Date
  • Gets the first day of the week for a given Date.

    Parameters

    • value: Date

      Original date.

    • Optional firstDayOfWeek: number

      First day of week (0 for Sunday, 1 for Monday, etc). Defaults to first day of week for the current culture.

    Returns Date

Static weekLast

  • weekLast(value: Date, firstDayOfWeek?: number): Date
  • Gets the last day of the week for a given Date.

    Parameters

    • value: Date

      Original date.

    • Optional firstDayOfWeek: number

      First day of week (0 for Sunday, 1 for Monday, etc). Defaults to first day of week for the current culture.

    Returns Date

Static yearFirst

  • yearFirst(value: Date): Date
  • Gets the first day of the year for a given Date.

    Parameters

    • value: Date

      Original date.

    Returns Date

Static yearLast

  • yearLast(value: Date): Date
  • Gets the last day of the year for a given Date.

    Parameters

    • value: Date

      Original date.

    Returns Date