Welcome to the UK List of
TeX Frequently Asked Questions
on the Web
TeX has a primitive register that contains “the number of minutes
since midnight”; with this knowledge it’s a moderately simple
programming job to print the time (one that no self-respecting
Plain TeX user would bother with anyone else’s code for).
However, LaTeX provides no primitive for “time”, so the
non-programming LaTeX user needs help.
Two packages are available, both providing ranges of ways of printing
the date, as well as of the time: this question will concentrate on
the time-printing capabilities, and interested users can investigate
the documentation for details about dates.
package defines two time-printing functions:
(for 24-hour time),
(for 12-hour time) and
(for time-as-words, albeit a slightly eccentric set of
package (part of the compendious
bundle) takes a package option (
) to specify how times are to be printed. The command
then prints the time appropriately (though there’s no
command also takes an optional argument, the character to separate the
hours and minutes: the default is of course
- macros/latex/contrib/datetime (or browse the directory)
- Distributed as part of macros/latex/contrib/koma-script (or browse the directory); catalogue entry
previous question, or
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=time
Comments, suggestions, or error reports? - see
“how to improve the FAQ”.
This is FAQ version 3.26, released on 2013-02-25.