Documentation

Time.Specifier

Parse and Format Specifier #

The general form is %&lt;modifier>&lt;width><alternate>&lt;specifier>, where &lt;modifier>, &lt;width>, and &lt;alternate> are optional.

modifier #

glibc-style modifiers can be used before the specifier (here marked as z):

width #

Width digits can also be used after any modifiers and before the specifier (here marked as z), for example:

alternate #

An optional E character indicates an alternate formatting. Currently this only affects %Z and %z.

specifier #

inductive Time.Specifier :
  • z : Specifier

    timezone offset in the format ±HHMM

  • Ez : Specifier

    timezone offset in the format ±HH: MM

  • Z : Specifier

    timezone name (or else offset in the format ±HHMM)

  • EZ : Specifier

    timezone name (or else offset in the format ±HH: MM)

  • P : Specifier

    day-half of day from (amPm locale), converted to lowercase, am, pm

  • p : Specifier

    day-half of day from (amPm locale), AM, PM

  • H : Specifier

    hour of day (24-hour), 0-padded to two chars, 00 - 23

  • k : Specifier

    hour of day (24-hour), space-padded to two chars, 0 - 23

  • I : Specifier

    hour of day-half (12-hour), 0-padded to two chars, 01 - 12

  • l : Specifier

    hour of day-half (12-hour), space-padded to two chars, 1 - 12

  • M : Specifier

    minute of hour, 0-padded to two chars, 00 - 59

  • S : Specifier

    second of minute (without decimal part), 0-padded to two chars, 00 - 60

  • q : Specifier

    picosecond of second, 0-padded to twelve chars, 000000000000 - 999999999999.

  • Q : Specifier

    decimal point and fraction of second, up to 12 second decimals, without trailing zeros. For a whole number of seconds, %Q omits the decimal point unless padding is specified.

  • u : Specifier

    day of week number for Week Date format, 1 (= Monday) - 7 (= Sunday)

  • w : Specifier

    day of week number, 0 (= Sunday) - 6 (= Saturday)

  • a : Specifier

    day of week, short form (snd from Time.TimeLocale.wDays locale), Sun - Sat

  • A : Specifier

    day of week, long form (fst from Time.TimeLocale.wDays locale), Sunday - Saturday

  • Y : Specifier

    year, no padding. Note %0Y and %_Y pad to four chars

  • G : Specifier

    year, no padding. Note %0Y and %_Y pad to four chars

  • y : Specifier

    year of century, 0-padded to two chars, 00 - 99

  • g : Specifier

    year of century, 0-padded to two chars, 00 - 99

  • C : Specifier

    century, no padding. Note %0C and %_C pad to two chars

  • B : Specifier

    month name, long form (fst from Time.TimeLocale.months locale), January - December

  • b : Specifier

    month name, short form (snd from Time.TimeLocale.months locale), Jan - Dec

  • m : Specifier

    month of year, 0-padded to two chars, 01 - 12

  • d : Specifier

    day of month, 0-padded to two chars, 01 - 31

  • e : Specifier

    day of month, space-padded to two chars, 1 - 31

  • j : Specifier

    day of year, 0-padded to three chars, 001 - 366

  • f : Specifier

    century for Week Date format, no padding. Note %0f and %_f pad to two chars

  • V : Specifier

    week of year for Week Date format, 0-padded to two chars, 01 - 53

  • U : Specifier

    week of year where weeks start on Sunday (as sundayStartWeek), 0-padded to two chars, 00 - 53

  • W : Specifier

    week of year where weeks start on Monday (as mondayStartWeek), 0-padded to two chars, 00 - 53

Instances For
    Instances For