summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-time.html
blob: 1747975ce303c349ffe90ee0dee641ca7de3a489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<head>
<title>UK TeX FAQ -- question label time</title>
</head><body>
<h3>Printing the time</h3>
<p>TeX has a primitive register that contains &ldquo;the number of minutes
since midnight&rdquo;; with this knowledge it&rsquo;s a moderately simple
programming job to print the time (one that no self-respecting
Plain TeX user would bother with anyone else&rsquo;s code for).
<p>However, LaTeX provides no primitive for &ldquo;time&rdquo;, so the
non-programming LaTeX user needs help.
<p>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.
<p>The <i>datetime</i> package defines two time-printing functions:
<code>\</code><code>xxivtime</code> (for 24-hour time), <code>\</code><code>ampmtime</code> (for 12-hour time) and
<code>\</code><code>oclock</code> (for time-as-words, albeit a slightly eccentric set of
words).
<p>The <i>scrtime</i> package (part of the compendious
<i>KOMA-Script</i> bundle) takes a package option (<code>12h</code> or
<code>24h</code>) to specify how times are to be printed.  The command
<code>\</code><code>thistime</code> then prints the time appropriately (though there&rsquo;s no
<em>am</em> or <em>pm</em> in <code>12h</code> mode).  The <code>\</code><code>thistime</code>
command also takes an optional argument, the character to separate the
hours and minutes: the default is of course <code>:</code>.
<dl>
<dt><tt><i>datetime.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/datetime.zip">macros/latex/contrib/datetime</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/datetime.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/datetime/">browse</a>)
<dt><tt><i>scrtime.sty</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/koma-script.zip">macros/latex/contrib/koma-script</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/koma-script.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/koma-script/">browse</a>)
</dl>
<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=time">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=time</a>
</body>