Dates can be printed with
fmt by using the
t code indicates a time is being printed, and the
flag indicates that the next argument is a
strftime()-style format string. Following that
is a time argument. Example:
<fmt "%at" "%B" "now"> where
"%B" is the
strftime()-style string (indicating the
month should be printed). A capital
T may be used instead of
t to change the timezone to Universal Time (GMT/UTC)
instead of local time for output. These
strftime() codes are
%afor the abbreviated weekday name (e.g.
%Afor the full weekday name (e.g.
%bfor the abbreviated month name (e.g.
%Bfor the full month name (e.g.
%cfor the preferred date and time representation.
%dfor the day of the month as a decimal number (range
%Hfor the hour as a decimal number using a 24-hour clock (range
%Ifor the hour as a decimal number using a 12-hour clock (range
%jfor the day of the year as a decimal number (range
%mfor the month as a decimal number (range
%Mfor the minute as a decimal number (range
PM, depending on the time.
%Sfor the second as a decimal number (range
60; 60 to allow for possible leap second if implemented).
%Ufor the week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week (range
%Wfor the week number of the current year as a decimal number, starting with the first Monday as the first day of the first week (range
%wfor the day of the week as a decimal, Sunday being 0.
%xfor the preferred date representation without the time.
%Xfor the preferred time representation without the date.
%yfor the year as a decimal number without a century (range
%Yfor the year as a decimal number including the century.
%Zfor the time zone or name or abbreviation.
%%for a literal `
fmt arguments are typecast if needed
(here), the date argument can be a Texis
counter type, or a Texis-parseable date string.
For example, to print today's date in the form month/day/year:
<fmt "%at" "%m/%d/%y" "now">
Or to print the title and insertion date of books matching a query,
in the style "
February 20, 1997" (assuming
id is a
<SQL "select id, Title from books where Desc like $query">
<fmt "%at" "%B %d, %Y" $id> $Title
strftime() string is composed entirely of
strftime()-specific codes, none of which have meaning as
<fmt> codes, and there is only one argument given, then the
%at may be omitted. For example, to print today's
year, either of these statements may be used:
<fmt "%at" "%Y" "now">
<fmt "%Y" "now">
The second statement eliminates the
%Y is a
strftime()-only code (not valid in
Due to potential confusion and conflicts between
<fmt> codes - especially as more codes/flags are added to the
latter - use of this shorthand is discouraged. Always use the
a flag and a
To use a default
strftime() format, eliminate the
flag and its corresponding
strftime() format argument:
<fmt "%t" "now">
This will print today's date in a default format.
As dates are printed using the standard
C library, not all
strftime() codes are available or behave identically on all