NAME
datefmt – print the date and time in various formats |
SYNOPSIS
datefmt [ –t seconds ] format |
DESCRIPTION
Datefmt prints the date at the current time according to format,
described below. With –t it will instead print the time at seconds,
the count of seconds since midnight on January 1, 1970.
|
VERBS
Basic values %A Full weekday name. %a Abbreviated weekday name. %B Full month name. %b Abbreviated month name. %C (year / 100) as a decimal number; single digits are preceded by a zero. %c Time and date; equivalent to %a %b %e %T %Y. %D Date; equivalent to %m/%d/%y. %d Day of the month as a decimal number (01–31). %e Day of the month as a decimal number (1–31); single digits are preceded by a blank. %F Date; equivalent to %Y–%m–%d. %H Hour (24–hour clock) as a decimal number (00–23). %h Abbreviated month name; equivalent to %b. %I Hour (12–hour clock) as a decimal number (01–12). %j Day of the year as a decimal number (001–366). %k Hour (24–hour clock) as a decimal number (0–23); single digits are preceded by a blank. %l Hour (12–hour clock) as a decimal number (1–12); single digits are preceded by a blank. %M Minute as a decimal number (00–59). %m Month as a decimal number (01–12). %n A newline. %p Either "AM" or "PM" as appropriate. %R Time; equivalent to %H:%M. %r Time; equivalent to %I:%M:%S %p. %S Second as a decimal number (00–60). %s Number of seconds since the Epoch, UTC (see time(2)). %T Current time; equivalent to %H:%M:%S. %t A tab. %u Weekday (Monday as the first day of the week) as a decimal number (1–7). %v Date; equivalent to %e–%b–%Y. %w Weekday (Sunday as the first day of the week) as a decimal number (0–6). %X Time; equivalent to %T. %x Current date; equivalent to %m/%d/%y. %Y Year with century as a decimal number. %y Year without century as a decimal number (00–99). %Z Time zone abbreviation. %z Time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (common form for RFC 822 date headers). |
EXAMPLE
Show the current date and time in a human–friendly way: :; datefmt '%a %b %e %T %Y%n' Sat Apr 13 05:45:45 2024 This is equivalent to datefmt %r%n. |
SOURCE
http://a.9srv.net/src/#datefmt for versions in both C and Limbo. |
SEE ALSO
mayan – a version for various Mayan calendars; http://a.9srv.net/src/#mayan.
|
BUGS
It's unclear some version of this shouldn't just be in date(1).
|