crow/io/time-format.crow (source)

Functions for formatting time values as strings.

Most of these take a unix-time; see get-unix-time in crow/io/time.

time-locale record

(has non-public fields)

    local-time time-locale()

    User's local time formatting preferences.

    gmt time-locale()

    Not summon because getting GMT from a timestamp is a pure function

    timezone-offset string(locale time-locale, time unix-time) summon

    Returns a value like "-0500".

    timezone-name string(locale time-locale, time unix-time) summon

    Returns a value like "EST".

    year string(locale time-locale, time unix-time) summon

    Year as a string, e.g. "2000".

    year-2-digit string(locale time-locale, time unix-time) summon

    Last 2 digits of the year, e.g. "00".

    date string(locale time-locale, time unix-time) summon

    Date formatted by local preferences.
    E.g., "2020-01-30" or "01/30/20".

    time-of-day string(locale time-locale, time unix-time) summon

    HH:MM:SS, e.g. 00:00:00.

    day-of-week-short string(locale time-locale, time unix-time) summon

    E.g. "Mon".

    day-of-week-long string(locale time-locale, time unix-time) summon

    E.g. "Monday".

    day-of-year string(locale time-locale, time unix-time) summon

    Day from 001 to 366 inclusive.

    month-short string(locale time-locale, time unix-time) summon

    Month like "Jan".

    month-long string(locale time-locale, time unix-time) summon

    Month like "January".

    month-number string(locale time-locale, time unix-time) summon

    Month from "01" to "12" inclusive.

    day-of-month string(locale time-locale, time unix-time) summon

    Day of month from "01" to "31" inclusive.

    iso-date string(locale time-locale, time unix-time) summon

    YYYY-MM-DD (ISO 8601 date format)

    iso-timestamp string(time unix-time) summon

    ISO 8601 full timestamp, in UTC.
    E.g.: 2000-01-01T00:00:00Z

    hour-of-24 string(locale time-locale, time unix-time) summon

    Hour from 00 to 23 inclusive.

    hour-of-12 string(locale time-locale, time unix-time) summon

    Hour from 1 to 12 inclusive.

    am-pm string(locale time-locale, time unix-time) summon

    "am" or "pm". "" in GMT.

    minute string(locale time-locale, time unix-time) summon

    Minute from 00 to 59 inclusive.

    second string(locale time-locale, time unix-time) summon

    Second from 00 to 60 inclusive.
    (60 for leap seconds.)