Time/date specifiers

There are two groups of time format specifiers: time/date and relative time. These may be used to generate axis tic labels or to encode time in a string. See set xtics time (p. [*]), strftime (p. [*]), strptime (p. [*]).

The time/date formats are

Date Specifiers
Format Explanation
%a abbreviated name of day of the week
%A full name of day of the week
%b or %h abbreviated name of the month
%B full name of the month
%d day of the month, 01–31
%D shorthand for "%m/%d/%y" (only output)
%F shorthand for "%Y-%m-%d" (only output)
%k hour, 0–23 (one or two digits)
%H hour, 00–23 (always two digits)
%l hour, 1–12 (one or two digits)
%I hour, 01–12 (always two digits)
%j day of the year, 001–366
%m month, 01–12
%M minute, 00–60
%p "am" or "pm"
%r shorthand for "%I:%M:%S %p" (only output)
%R shorthand for %H:%M" (only output)
%S second, integer 00–60 on output, (double) on input
%s number of seconds since start of year 1970
%T shorthand for "%H:%M:%S" (only output)
%U week of the year (CDC/MMWR "epi week") (ignored on input)
%w day of the week, 0–6 (Sunday = 0)
%W week of the year (ISO 8601 week date) (ignored on input)
%y year, 0-99 in range 1969-2068
%Y year, 4-digit
%z timezone, [+-]hh:mm
%Z timezone name, ignored string

For more information on the %W format (ISO week of year) see tm_week (p. [*]). The %U format (CDC/MMWR epidemiological week) is similar to %W except that it uses weeks that start on Sunday rather than Monday. Caveat: Both the %W and the %U formats were unreliable in gnuplot versions prior to 5.4.2. See unit test "week_date.dem".

The relative time formats express the length of a time interval on either side of a zero time point. The relative time formats are

Time Specifiers
Format Explanation
%tD +/- days relative to time=0
%tH +/- hours relative to time=0 (does not wrap at 24)
%tM +/- minutes relative to time=0
%tS +/- seconds associated with previous tH or tM field

Numerical formats may be preceded by a "0" ("zero") to pad the field with leading zeroes, and preceded by a positive digit to define the minimum field width. The %S, and %t formats also accept a precision specifier so that fractional hours/minutes/seconds can be written.



Subsections