[OS X TeX] datetime

Ross Moore ross at ics.mq.edu.au
Wed Jul 12 23:59:09 CEST 2006


Hi Jack,

On 13/07/2006, at 7:38 AM, Jack Kuipers wrote:

> Dear: Whoever, (Knowledgable Ones)
> In \documentclass[twosided,12pt]{book} how can I record the date and 
> the time.

  \today  is available in all LaTeX classes.
It is usual to declare  \date{\today}   prior to using  \maketitle ,
to include date information in the title of a document.

However, LaTeX also writes into auxiliary files the time when a job 
starts,
using the following coding (from  latex.ltx):

\begingroup
\makeatletter
\count@\time
\divide\count@ 60
\count2=-\count@
\multiply\count2 60
\advance\count2 \time
\edef\today{%
   \the\year/\two at digits{\the\month}/\two at digits{\the\day}:%
     \two at digits{\the\count@}:\two at digits{\the\count2}}
\immediate\openout15=texsys.aux
\immediate\write15{\today^^J}
\immediate\closeout15 %
\endgroup

This accesses the TeX primitives  \time   \year  \month  \day
each of which return integers.
For \time, it is the number of minutes that have elapsed since midnight.

The above coding (integer) divides this number by 60 to get the hours,
and uses the remainder for the minutes.
A LaTeX-defined macro \two at digits is used to pad out single-digit
numbers with a leading 0.


> In \documentstyle ... I would usepackage{datetime} and \now  and \date
> I have been unable to find any  package that works with 
> \documentclass[...]{...}
> 			Thanx (in advance),	
> 				Jack Kuipers
>

Hope this helps,

	Ross

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list