Namespace: date

qui.utils.date

Methods

(static) formatDurationPercent(duration, format) → {String}

Transform a time duration into a string, according to the given format. Recognized placeholders:

  • "%d" - number of days
  • "%H" - number of hours, from "00" to "23"
  • "%M" - number of minutes, from "00" to "59"
  • "%S" - number of seconds, from "00" to "59"
  • "%f" - number of milliseconds, from "000" to "999"

Use a - character in front of a format specifier to remove zero padding (e.g. "%-H"`).

Parameters:
Name Type Description
duration Number

duration, in milliseconds

format String

the format to be used

Source:
Returns:

the formatted duration

Type
String

(static) formatPercent(date, format, transopt) → {String}

Transform a date into a string, according to the given format. Recognized placeholders:

  • "%a" - short week day name (e.g. "Mon")
  • "%A" - long week day name (e.g. "Monday")
  • "%w" - day of week, from "0" (Sunday) to "6" (Saturday),
  • "%u" - day of week, from "1" (Monday) to "7" (Sunday),
  • "%d" - zero padded day of month, from "00" to "31'
  • "%b" - short month name (e.g. "Apr")
  • "%B" - long month name (e.g. "April")
  • "%m" - zero padded month number, from "01" to "12"
  • "%y" - zero padded short year (e.g. "97" or "03")
  • "%Y" - zero padded long year (e.g. "1997" or "2003")
  • "%H" - zero padded hour, from "00" to "23"
  • "%I" - zero padded hour, from "00" to "11"
  • "%p" - "am" or "pm"
  • "%M" - zero padded minutes, from "00" to "59"
  • "%S" - zero padded seconds, from "00" to "59"
  • "%f" - zero padded milliseconds, from "000" to "999"

Use a - character in front of a format specifier to remove zero padding (e.g. "%-d"`).

Parameters:
Name Type Attributes Description
date Date

the date to format

format String

the format to be used

trans Boolean <optional>

whether to translate week day and month names; defaults to true

Source:
Returns:

the formatted date

Type
String

(static) toUTC(date) → {Date}

Transform a given date object into its UTC equivalent.

Parameters:
Name Type Description
date Date
Source:
Returns:
Type
Date