Skip to content

fmt-time

let fmt-time(
  dt,
  locale: "en",
  length: "short"
)

Formats a time in some locale.

Arguments

dt

The time to format. This can be a datetime or a dictionary with hour, minute, second.

Example

#fmt-time(datetime(
    hour: 13,
    minute: 5,
    second: 0,
)) \
#fmt-time(( // (1)!
    hour: 14,
    minute: 53,
    second: 0,
), locale: "be")

  1. Time passed as a dictionary

PreviewPreview

locale

The locale to use when formatting the time. A Unicode Locale Identifier.

Example

#let f(locale) = fmt-time(
  (hour: 13, minute: 5, second: 23),
  locale: locale,
  length: "medium",
) // (1)!

- #f("it")
- #f("ar")
- #f("en-u-hc-h12")
- #f("en-u-hc-h24")
- #f("ne")
- #f("ms")
- #f("de")

  1. Wrapper to set the length

PreviewPreview

length

The length of the formatted time ("medium", "short" (default)).

Example

#let time = (
  hour: 13,
  minute: 5,
  second: 23
)

- #fmt-time(time, length: "medium")
- #fmt-time(time, length: "medium", locale: "tg")
- #fmt-time(time, length: "short")
- #fmt-time(time, length: "short", locale: "gd")

PreviewPreview