Options
All
  • Public
  • Public/Protected
  • All
Menu

Module FormatAndConvert/formatDateAndTime

Index

Functions

configureFormatDateAndTime

  • Can be used to configure the localization. The configuration can either be done by supplying a js object, or by setting a string containing the format, which is especially useful, because you only have to supply a single translation value from your backend. The string should be formatted as a 4 comma separated lists that are separated by pipe characters. example: monthNames,monthNames...|monthNamesAbbr,monthNamesAbbr...|weekDays,weekDays...|weekDaysAbbr,weekDaysAbbr...

    Parameters

    Returns void

formatDateAndTime

  • formatDateAndTime(format: string, date?: Date): string
  • This is a small implementation of the date formater which is used in php The format string can use the same modifiers as in the documentation.

    Currently supported are: d Day of the month, 2 digits with leading zeros 01 to 31 D A textual representation of a day, three letters Mon through Sun j Day of the month without leading zeros 1 to 31 l A full textual representation of the day of the week Sunday through Saturday w Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday) n Numeric representation of a month, without leading zeros 1 through 12 F A full textual representation of a month, such as January or March January through December m Numeric representation of a month, with leading zeros 01 through 12 M A short textual representation of a month, three letters Jan through Dec G 24-hour format of an hour without leading zeros 0 through 23 H 24-hour format of an hour with leading zeros 00 through 23 i Minutes with leading zeros 00 to 59 s Seconds, with leading zeros 00 through 59

    // Special formats which are supported: mysql Returns the mysql datetime representation of the date

    Parameters

    • format: string
    • Optional date: Date

    Returns string

getDateAndTimeFormat

  • getDateAndTimeFormat(type: "monthNames" | "monthNamesAbbr" | "weekDays" | "weekDaysAbbr"): string[]
  • Returns an array containing the list of all valued for the required type

    Parameters

    • type: "monthNames" | "monthNamesAbbr" | "weekDays" | "weekDaysAbbr"

    Returns string[]

getNameOfDay

  • getNameOfDay(day: number, short?: boolean): string
  • Returns the name of the day either full or short textual representation

    Parameters

    • day: number

      The numeric representation of the day to get the name for 0: Sunday, 1: Monday...

    • Optional short: boolean

      If true the short textual representation is returned

    Returns string

getNameOfMonth

  • getNameOfMonth(month: number, short?: boolean): string
  • Returns the name of a given month, either as full or short textual representation

    Parameters

    • month: number

      The numeric representation of the month to get the

    • Optional short: boolean

      If true the short textual representation is returned

    Returns string

Generated using TypeDoc