Command ‘date +FORMAT’ — What are %a, %A, %b, etc. called

dateterminology

The date command outputs the current date and time like this: Fri Apr 12 15:04:03 UTC 2013.

To have the output date-time in a custom format we can use date +FORMAT, for example, like this: date "+%Y-%m-%dT%H:%M:%S%:z" which gives something like 2013-04-12T15:04:37+00:00.

But I want to know what the %Y, %m, %d, %H, %M, %S, etc. are collectively called (i.e. the terminology). Also, what's the T called, as it's different from the rest?

Best Answer

The term used in the POSIX specification of the date command is "conversion specifications".

The format string for the date command is closely based on the format string for C's printf function; the C standard also refers to things like %d as "conversion specifications".

T not preceded by % is just a character: "All other characters shall be copied to the output without change."

According to the change history section of the POSIX description of date:

The DESCRIPTION is updated to refer to conversion specifications, instead of field descriptors for consistency with the LC_TIME category.

So apparently an earlier version of the specification used the phrase "field descriptors", but "conversion specifications" is the current official term.

Of course that doesn't mean you have to refer to them that way.

Related Question