Debian Codegraph @

texmf-dist/doc/latex/datetime/datetime-manual.tex

raw
1 \documentclass{nlctdoc}
2
3 \usepackage[colorlinks,
4 bookmarks,
5 bookmarksopen,
6 hyperindex=false,
7 pdfauthor={Nicola L.C. Talbot},
8 pdftitle={datetime.sty: A Date and Time Package},
9 pdfkeywords={date,time,LaTeX}]{hyperref}
10
11 \usepackage{creatdtx}
12
13 \begin{document}
14 \RecordChanges
15 \OnlyDescription
16
17 \title{datetime.sty v2.60:
18 Formatting Current Date and Time}
19 \author{Nicola L. C. Talbot\\[10pt]
20 Dickimaw Books\\
21 \url{http://www.dickimaw-books.com/}}
22 \date{2015-03-20}
23 \maketitle
24
25 \begin{important}
26 This is the last version of this package. The replacement package is
27 called \sty{datetime2} and will be released shortly after the
28 this final version.
29 \end{important}
30
31 \tableofcontents
32
33 \section{Introduction}
34 \changes{1.0}{2000/08/08}{First release}
35 \changes{1.01}{2000/09/18}{Documentation added}
36 The \styfmt{datetime} package is a \LaTeXe\ package that
37 provides various different formats for \ics{today},
38 and provides commands for displaying the current time.
39 If you only want the
40 time commands but not the date changing commands, you can pass
41 the option \pkgopt{nodate} to the package.
42 \changes{2.3}{2004/05/01}{nodate package option added}
43
44 \changes{2.41}{2004/10/22}{split package into two files:
45 datetime.sty and fmtcount.sty}
46 Since version 2.4, the \styfmt{datetime} package has been
47 separated into two packages: \styfmt{datetime} and
48 \sty{fmtcount}. When I originally created this package,
49 I defined the commands, \ics{ordinal} etc which could be used
50 in the definition of \cs{today}. Since then, I have extended
51 the number of commands available that can be used to display the
52 value of a \LaTeX\ counter, however it seems more appropriate to
53 define all these counter-related commands in a separate package.
54 The \sty{fmtcount} package is now distributed separately
55 from the \styfmt{datetime} package, and will also need to
56 be installed.
57
58 \changes{2.42}{2004/11/01}{made package compatible with babel}
59 As from version 2.42, the \styfmt{datetime} package is now
60 compatible with \sty{babel}, however you must load the
61 \styfmt{datetime} package \emph{after} the \sty{babel} package.
62 For example:
63 \begin{verbatim}
64 \usepackage[francais]{babel}
65 \usepackage{datetime}
66 \end{verbatim}
67
68 \section{Predefined Date Formats}
69 There are various declarations that change the effect of
70 \ics{today}. The change can be localised by placing the
71 declaration within a group.
72
73 As from version 2.43, the numerical date formats (such as
74 \ics{ddmmyyyydate}) use the command
75 \begin{definition}[\DescribeMacro{\dateseparator}]
76 \cs{dateseparator}
77 \end{definition}
78 to separate the numbers. So, for example, if you want to hyphens
79 instead of slashes, you can do:
80 \begin{verbatim}
81 \renewcommand{\dateseparator}{-}
82 \end{verbatim}
83
84 \subsection{ISO format}
85
86 \begin{definition}[\DescribeMacro{\yyyymmdddate}]
87 \cs{yyyymmdddate}
88 \end{definition}
89 This declaration will redefine \ics{today} to produce the current
90 date displayed in the form 2000/03/08. (You can redefine
91 \ics{dateseparator} to \texttt{-} to change to 2000-03-08.)
92
93 \subsection{\texorpdfstring{\meta{Day} \meta{Month} \meta{Year}}{Day Month Year} formats}
94
95 \begin{definition}[\DescribeMacro{\longdate}]
96 \cs{longdate}
97 \end{definition}
98 This declaration will redefine \ics{today} to produce the current
99 date displayed in the form Wednesday 8\textsuperscript{th} March,
100 2000 if the package option \pkgopt{dayofweek} is used, or
101 8\textsuperscript{th} March, 2000 if the package option
102 \pkgopt{nodayofweek} is used.
103
104 \begin{definition}[\DescribeMacro{\shortdate}]
105 \cs{shortdate}
106 \end{definition}
107 This declaration will redefine \ics{today} to produce the current
108 date displayed in the form Wed 8\textsuperscript{th} Mar, 2000 if
109 the package option \pkgopt{dayofweek} is used, or
110 8\textsuperscript{th} Mar, 2000 if the package option
111 \pkgopt{nodayofweek} is used.
112
113 \begin{definition}[\DescribeMacro{\ddmmyyyydate}]
114 \cs{ddmmyyyydate}
115 \end{definition}
116 This declaration will redefine \ics{today} to produce the current
117 date displayed in the form 08/03/2000.
118
119 \begin{definition}[\DescribeMacro{\dmyyyydate}]
120 \cs{dmyyyydate}
121 \end{definition}
122 This declaration will redefine \ics{today} to produce the current
123 date displayed in the form 8/3/2000.
124
125 \begin{definition}[\DescribeMacro{\ddmmyydate}]
126 \cs{ddmmyydate}
127 \end{definition}
128 This declaration will redefine \ics{today} to produce the current
129 date displayed in the form 08/03/00.
130
131 \begin{definition}[\DescribeMacro{\dmyydate}]
132 \cs{dmyydate}
133 \end{definition}
134 This declaration will redefine \ics{today} to produce the current
135 date displayed in the form 8/3/00.
136
137 \begin{definition}[\DescribeMacro{\textdate}]
138 \cs{textdate}
139 \end{definition}
140 This declaration will redefine \ics{today} to produce the current
141 date displayed in the form: Wednesday the Eighth of March, Two
142 Thousand if the package option \pkgopt{dayofweek} is used, or Eighth
143 of March, Two Thousand if the package option \pkgopt{nodayofweek} is
144 used. Note that \cs{textdate} is defined for use with English, it
145 won't look right if it is used when another language has been
146 selected\footnote{in fact, you may get an error from the
147 \sty{fmtcount} package if you are using a language that it doesn't
148 support.}. If you want to define a similar command for another
149 language, you will first need to check that the \sty{fmtcount}
150 package supports that language.
151
152 \subsection{\texorpdfstring{\meta{Month} \meta{Day} \meta{Year}}{Month Day Year} formats}
153
154 \begin{definition}[\DescribeMacro{\usdate}]
155 \cs{usdate}
156 \end{definition}
157 This declaration will redefine \cs{today} to produce the current
158 date displayed in the form March 8, 2000. (As \TeX\ and \LaTeX\ do
159 by default.)
160
161 \begin{definition}[\DescribeMacro{\mmddyyyydate}]
162 \cs{mmddyyyydate}
163 \end{definition}
164 This declaration will redefine \ics{today} to produce the current
165 date displayed in the form 03/08/2000.
166
167 \begin{definition}[\DescribeMacro{\mdyyyydate}]
168 \cs{mdyyyydate}
169 \end{definition}
170 This declaration will redefine \verb"\today" to produce the current
171 date displayed in the form 3/8/2000.
172
173 \begin{definition}[\DescribeMacro{\mmddyydate}]
174 \cs{mmddyydate}
175 \end{definition}
176 This declaration will redefine \ics{today} to produce the current
177 date displayed in the form 03/08/00.
178
179 \begin{definition}[\DescribeMacro{\mdyydate}]
180 \cs{mdyydate}
181 \end{definition}
182 This declaration will redefine \ics{today} to produce the current
183 date displayed in the form 3/8/00.
184
185 \subsection{Dates defined by \texorpdfstring{\styfmt{babel}}{babel}}
186
187 In addition to the above, the declarations \cs{date}\meta{lang} are
188 available for all languages defined either by calling \sty{babel}
189 prior to \styfmt{datetime} or by passing the language name as an
190 option to \styfmt{datetime}. See~\sectionref{sec:newdate} if you
191 want to define your own customised date format.
192
193 \section{Time Commands}
194
195 The current time is displayed using the command
196 \begin{definition}[\DescribeMacro{\currenttime}]
197 \cs{currenttime}
198 \end{definition}
199
200 A specific time can be displayed using the command
201 \begin{definition}[\DescribeMacro{\formattime}]
202 \cs{formattime}\marg{hour}\marg{minute}\marg{second}
203 \end{definition}
204 where \meta{hour} is a number from~0 to~23, and \meta{minute} and
205 \meta{second} are numbers from~0 to~59.
206
207 The format can be changed using the declaration
208 \begin{definition}[\DescribeMacro{\settimeformat}]
209 \cs{settimeformat}\marg{style}
210 \end{definition}
211 where \meta{style} is the name of the
212 format. Predefined formats are:
213 \begin{description}
214 \item[xxivtime] Twenty-four hour time in the form 22:28 (Default)
215 \item[hhmmsstime] Twenty-four hour time in the form 22:28:00
216 \item[ampmtime] Twelve hour time in the form 10:28pm
217 \item[oclock] Displays the current time as a string, e.g.\
218 Twenty-Eight minutes past Ten in the afternoon.
219 \end{description}
220
221 New time formats can be defined using the command:
222 \begin{definition}[\DescribeMacro{\newtimeformat}]
223 \cs{newtimeformat}\marg{name}\marg{format}
224 \end{definition}
225 where \meta{name} is the name of the new format (used in
226 \ics{settimeformat}), and \meta{format} is how to format the time.
227 Within \meta{format} you can use the counters \ctr{HOUR} (number
228 of hours after midnight), \ctr{MINUTE} (number of minutes past
229 the hour), \ctr{SECOND} (number of seconds) \ctr{HOURXII}
230 (number of hours after midnight/midday), \ctr{TOHOUR} (the next
231 hour) and \ctr{TOMINUTE} (number of minutes to the next hour),
232 and the corresponding commands: \ics{THEHOUR}, \ics{THEMINUTE},
233 \ics{THESECOND}, \ics{THEHOURXII}, \ics{THETOHOUR} and
234 \ics{THETOMINUTE}.
235
236 For example, to define a new time format that uses a dot instead of a
237 colon:
238 \begin{verbatim}
239 \newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}}
240 \end{verbatim}
241 You then need to switch to this new format before you can use it:
242 \begin{verbatim}
243 \settimeformat{dottime}
244 \currenttime
245 \end{verbatim}
246
247 As from version 2.43, if you only want to change the separator,
248 you can simply redefine
249 \begin{definition}[\DescribeMacro{\timeseparator}]
250 \cs{timeseparator}
251 \end{definition}
252 instead of defining a new time format. For example:
253 \begin{verbatim}
254 \renewcommand{\timeseparator}{.}
255 \end{verbatim}
256 The \texttt{xxivtime} format will now work like the \texttt{dottime}
257 format defined above.
258
259 \section{Formating Dates}
260 \begin{definition}[\DescribeMacro{\pdfdate}]
261 \cs{pdfdate}
262 \end{definition}
263 This command\footnote{thanks to Ulrich Dirr for
264 asking about this} prints the date in the format required for
265 PDF files, e.g.\ if the date is 1 May 2004 and time is
266 22:02, \verb"\pdfdate" will print 20040501220200. The reason
267 this date format is separate from all the others is because the
268 other form doesn't get properly expanded by PDF\TeX. (This
269 command is defined regardless of whether the package option
270 \texttt{nodate} is called.)
271 Example:
272 \begin{verbatim}
273 \pdfinfo{
274 /Author (Me)
275 /Title (A Sample Document)
276 /CreationDate (D:20040501215500)
277 /ModDate (D:\pdfdate)
278 }
279 \end{verbatim}
280 \textbf{Note} that PDF\TeX\ introduced the new primitive
281 \cs{pdfcreationdate} in version 1.30.0, so \cs{pdfdate} isn't
282 required with newer versions of PDF\TeX. (\cs{pdfcreationdate}
283 is better than \cs{pdfdate} as it also stores the time zone.)
284
285 There are two commands that print the name of the current
286 month:
287 \begin{definition}[\DescribeMacro{\monthname}]
288 \cs{monthname}\oarg{num}
289 \end{definition}
290 prints the current month name in full,
291 e.g.\ August, and
292 \begin{definition}[\DescribeMacro{\shortmonthname}]
293 \cs{shortmonthname}\oarg{num}
294 \end{definition}
295 prints the abbreviated month name, e.g.\ Aug. Both \cs{monthname}
296 and \cs{shortmonthname} take an optional argument (a number from 1
297 to 12) if the name of a specific month is required. For example,
298 \verb"\monthname[6]" will produced the output: June.
299
300 The day of the week is computed using the algorithm documented at
301 \url{http://userpages.wittenburg.edu/bshelburne/Comp150/DayOfWeek.htm}.
302 This algorithm works for any date between 1\textsuperscript{st}
303 Jan, 1901 and 31\textsuperscript{st} Dec, 2099.
304 The following macros display the day of week for a given date:
305
306 \begin{definition}[\DescribeMacro{\dayofweekname}]
307 \cs{dayofweekname}\marg{day}\marg{month}\marg{year}
308 \end{definition}
309 prints the day of week for the specified date. For example,
310 \begin{verbatim}
311 \dayofweekname{31}{10}{2002}
312 \end{verbatim}
313 will produce the output: Thursday.
314
315 \begin{definition}[\DescribeMacro{\shortdayofweekname}]
316 \cs{shortdayofweekname}\meta{day}\marg{month}\marg{year}
317 \end{definition}
318 prints the abbreviated name for the day of week for the specified
319 date. For example
320 \begin{verbatim}
321 \shortdayofweekname{31}{10}{2002}
322 \end{verbatim}
323 will produce the output: Thu.
324
325 \begin{definition}[\DescribeMacro{\ifshowdow}]
326 \cs{ifshowdow}
327 \end{definition}
328 This \TeX\ conditional can be used to determine whether or not the
329 option \pkgopt{dayofweek} has been passed to the package. For
330 example:
331 \begin{verbatim}
332 \ifshowdow\dayofweekname{31}{10}{2002} \fi
333 \end{verbatim}
334 will only display the day of week if the \pkgopt{dayofweek} option
335 was passed to \styfmt{datetime}. Alternatively, you can use
336 David~Carlisle's \sty{ifthen} package:
337 \begin{verbatim}
338 \ifthenelse{\boolean{showdow}}{\dayofweekname{31}{10}{2002} }{}
339 \end{verbatim}
340
341 The command
342 \begin{definition}[\DescribeMacro{\ordinaldate}]
343 \cs{ordinaldate}\marg{number}
344 \end{definition}
345 displays \meta{number} as a date-type ordinal. If the current
346 language is English, this will simply pass the argument to
347 \ics{ordinalnum} (defined in the \sty{fmtcount} package), if the
348 current language is Breton, Welsh or French, a superscript will only
349 be added if \meta{number} is 1, otherwise only \meta{number} will be
350 displayed.
351
352 The macro\footnote{Note the name change since version 1.1. The
353 command name was changed from \cs{thedate} to \cs{formatdate} to
354 avoid a name clash when using the \sty{seminar} class file.}
355 \begin{definition}[\DescribeMacro{\formatdate}]
356 \cs{formatdate}\marg{day}\marg{month}\marg{year}
357 \end{definition}
358 formats the specified date according to the current format of
359 \ics{today}\footnote{To be more precise, \ics{today} is defined to
360 be \ics{formatdate}\{\cs{day}\}\{\cs{month}\}\{\cs{year}\} where
361 \ics{longdate} etc change the definition of \cs{formatdate}}.
362 (Arguments must all be integers.) For example, in combination with
363 \ics{longdate}, the command
364 \begin{verbatim}
365 \formatdate{27}{9}{2004}
366 \end{verbatim}
367 will produce the output: Monday 27\textsuperscript{th} September,
368 2004.
369
370 You can ensure that a number is displayed with at least two digits
371 using the command
372 \begin{definition}[\DescribeMacro{\twodigit}]
373 \cs{twodigit}\marg{num}
374 \end{definition}
375
376 \section{Defining New Date Formats}\label{sec:newdate}
377
378 New date formats can be defined using the command:
379 \begin{definition}[\DescribeMacro{\newdateformat}]
380 \cs{newdateformat}\marg{name}\marg{format}
381 \end{definition}
382 where \meta{name} is the name of the new format, and \meta{format}
383 is how to format the date. Within the argument \meta{format} you can
384 use the commands \ics{THEDAY}, \ics{THEMONTH} and \ics{THEYEAR} to
385 represent the relevant day, month and year, or you can use the
386 counters \ctr{DAY}, \ctr{MONTH} and \ctr{YEAR} if you want to use
387 \ics{ordinal} etc. Once you have defined the new date format, you
388 can then switch to it using the declaration \verb'\'\meta{name}
389 (i.e.\ the name you specified preceded by a backslash), and
390 subsequent calls to \ics{today} and \ics{formatdate} will use your
391 new format.
392
393 For example, suppose you want to define a new date format called,
394 say, \texttt{mydate}, that will typeset the date in the form:
395 8-3-2002, then you can do:
396 \begin{verbatim}
397 \newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR}
398 \end{verbatim}
399 \ics{newdateformat} will then define the declaration
400 \cs{mydate} which can be used to
401 switch to your new format. In the following example,
402 two new date formats are defined, and they are then
403 selected to produce two different formats for the current date:
404 \begin{verbatim}
405 \newdateformat{dashdate}{%
406 \twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR}
407
408 \newdateformat{usvardate}{%
409 \monthname[\THEMONTH] \ordinal{DAY}, \THEYEAR}
410
411 Dash: \dashdate\today.
412 US: \usvardate\today.
413 \end{verbatim}
414 If the current date is, say, 8th March, 2002, the above code will
415 produce the following: Dash: 08-03-2002. US: March
416 8\textsuperscript{th}, 2002.
417
418 Note that \ics{THEDAY} etc and \ctr{DAY} etc have no real
419 meaning outside \ics{newdateformat} (this is why they
420 are in uppercase). Incidentally, the \texttt{dashdate} format
421 is not really necessary, as you can achieve this format
422 using:
423 \begin{verbatim}
424 \renewcommand{\dateseparator}{-}
425 \ddmmyyyydate
426 \end{verbatim}
427
428 Another note: in the above code, \ics{ordinal} was
429 used to illustrate the use of the \ctr{DAY} counter. It
430 is better to use \ics{ordinaldate} instead:
431 \begin{verbatim}
432 \newdateformat{usvardate}{%
433 \monthname[\THEMONTH] \ordinaldate{\THEDAY}, \THEYEAR}
434 \end{verbatim}
435
436 \section{Saving Dates}
437
438 It is possible to save a date for later use using the command:
439 \footnote{Thanks to Denis Bitouz\'e for asking about this}
440 \begin{definition}[\DescribeMacro{\newdate}]
441 \cs{newdate}\marg{name}\marg{day}\marg{month}\marg{year}
442 \end{definition}
443
444 This date can later be displayed using the same format as that
445 used by \ics{formatdate} using the command:
446 \begin{definition}[\DescribeMacro{\displaydate}]
447 \cs{displaydate}\marg{name}
448 \end{definition}
449
450 Individual elements of the date can be extracted using the
451 commands:
452 \begin{definition}[\DescribeMacro{\getdateday}]
453 \cs{getdateday}\marg{name}
454 \end{definition}
455 \begin{definition}[\DescribeMacro{\getdatemonth}]
456 \cs{getdatemonth}\marg{name}
457 \end{definition}
458 \begin{definition}[\DescribeMacro{\getdateyear}]
459 \cs{getdateyear}\marg{name}
460 \end{definition}
461
462 \section{Predefined Names}
463
464 The following commands are defined by the \styfmt{datetime}
465 package:
466
467 \begin{tabular}{ll}
468 \bfseries Command Name & \bfseries Default Value\\
469 \ics{dateseparator} & \verb'/'\\
470 \ics{timeseparator} & \verb':'\\
471 \ics{amname} & \texttt{am}\\
472 \ics{pmname} & \texttt{pm}\\
473 \ics{amorpmname} & \ics{amname} if morning, otherwise \ics{pmname}\\
474 \ics{amstring} & \texttt{in the morning}\\
475 \ics{pmstring} & \texttt{in the afternoon}\\
476 \ics{amorpmstring} & \ics{amstring} if morning, otherwise
477 \ics{pmstring}\\
478 \ics{halfpast} & \texttt{Half past}\\
479 \ics{quarterpast} & \texttt{Quarter past}\\
480 \ics{quarterto} & \texttt{Quarter to}\\
481 \ics{noon} & \texttt{Noon}\\
482 \ics{midnight} & \texttt{Midnight}\\
483 \ics{oclockstring} & \texttt{O'Clock}
484 \end{tabular}
485
486 \section{Package Options}
487
488 The following options may be passed to this package:
489 \begin{description}
490 \item[\pkgopt{long}] make \cs{today} produce long date
491 \item[\pkgopt{short}] make \cs{today} produce short date
492 \item[\pkgopt{yyyymmdd}] make \cs{today} produce YYYY/MM/DD date
493 \item[\pkgopt{ddmmyyyy}] make \cs{today} produce DD/MM/YYYY date
494 \item[\pkgopt{dmyyyy}] make \cs{today} produce D/M/YYYY date
495 \item[\pkgopt{ddmmyy}] make \cs{today} produce DD/MM/YY date
496 \item[\pkgopt{dmyy}] make \cs{today} produce D/M/YY date
497 \item[\pkgopt{text}] make \cs{today} produce text date in UK style
498 \item[\pkgopt{us}] make \cs{today} produce US style date
499 \item[\pkgopt{mmddyyyy}] make \cs{today} produce MM/DD/YYYY date
500 \item[\pkgopt{mdyyyy}] make \cs{today} produce M/D/YYYY date
501 \item[\pkgopt{mmddyy}] make \cs{today} produce MM/DD/YY date
502 \item[\pkgopt{mdyy}] make \cs{today} produce M/D/YY date
503 \item[\pkgopt{raise}] make ordinal st,nd,rd,th appear as superscript
504 \item[\pkgopt{level}] make ordinal st,nd,rd,th appear level with rest of
505 text
506 \item[\pkgopt{dayofweek}] make the day of week appear for \ics{longdate},
507 \ics{shortdate}
508 or \ics{textdate}
509 \item[\pkgopt{nodayofweek}] don't display the day of week.
510 \item[\pkgopt{hhmmss}] make \cs{currenttime} produce \texttt{hhmmsstime}
511 format
512 \item[\pkgopt{24hr}] make \cs{currenttime} produce \texttt{xxivtime}
513 format
514 \item[\pkgopt{12hr}] make \cs{currenttime} produce \texttt{ampmtime}
515 format
516 \item[\pkgopt{oclock}] make \cs{currenttime} produce \texttt{oclock}
517 format
518 \item[\pkgopt{nodate}] Don't redefine \cs{today} or define the month or
519 day of week commands
520 (useful if you only want the time commands)
521 \item[\pkgopt{iso}] as \pkgopt{ddmmyyyy} and \pkgopt{hhmmss} but
522 also sets date separator to \texttt{-}
523 and time separator to \texttt{:}
524 \end{description}
525
526 The default options are: \pkgopt{long}, \pkgopt{raise},
527 \pkgopt{dayofweek} and \pkgopt{24hr}.
528
529 \section{Multilingual Support}
530
531 If you use the \sty{ngerman} package, you must use \styfmt{datetime}'s
532 \pkgopt{ngerman} package option if you want the date displayed
533 in the same form as \sty{ngerman}. You must also load \sty{ngerman}
534 \emph{before} you load \styfmt{datetime}. Similarly for the
535 \sty{german} package.
536
537 If you want to use the \sty{babel} package, you must load
538 it \emph{before} you load the \styfmt{datetime} package. This
539 is because the \sty{babel} \cs{date}\meta{lang} commands
540 redefine \ics{today}, whereas the \sty{datetime} package
541 redefines \cs{today} to use \ics{formatdate}, and the
542 date formatting commands (such as \ics{longdate}) redefine
543 \cs{formatdate} rather than \cs{today}. This ensures
544 consistent formatting of the dates whether you use \cs{today} or
545 \cs{formatdate}. Therefore, the \styfmt{datetime} package
546 has to redefine all the \cs{date}\meta{lang} commands accordingly.
547 Thus the multilingual date support is mostly limited to that provided
548 by \sty{babel}. Additional support, such as the day of
549 week names and abbreviations, are only supplied for those
550 languages that I know, or that other people have been able to supply
551 for me.
552
553 As from v2.56, the package options supplied to \styfmt{datetime}
554 override \sty{babel}'s date format. For example:
555 \begin{verbatim}
556 \usepackage[french,spanish]{babel}
557 \usepackage[ddmmyyyy]{datetime}
558 \end{verbatim}
559 will use ddmmyyyy date format regardless of language. Note that
560 if you use a declaration instead of a package option, for
561 example:
562 \begin{verbatim}
563 \usepackage[french,spanish]{babel}
564 \usepackage{datetime}
565 \ddmmyyyydate
566 \end{verbatim}
567 the date format will be switched back to \cs{datefrench} or
568 \cs{datespanish} whenever the language is set. You can use
569 \begin{definition}[\DescribeMacro{\setdefaultdate}]
570 \cs{setdefaultdate}\marg{declaration}
571 \end{definition}
572 to always use \marg{declaration} whenever the language
573 is set. For example:
574 \begin{verbatim}
575 \setdefaultdate{\ddmmyyyydate}
576 \end{verbatim}
577
578 The commands \ics{monthname} and \ics{shortmonthname},
579 will produce the month name in the current language.
580 If you want the month name in a specific language, you
581 can use the command \cs{monthname}\meta{lang}.
582 For example, \verb"\monthnamefrench[6]" will produce the output:
583 juin. Note that \ics{textdate} is formatted for English dates,
584 and won't look right if used with another language setting. If you
585 want a textual date, the \sty{fmtcount} package (which is
586 loaded by \styfmt{datetime}) defines some commands which display
587 a number or ordinal as a word, but it only has very limited
588 multilingual support. See the \sty{fmtcount} documentation
589 for further details.
590
591 \section{Registers}
592
593 \TeX\ provides \ics{day}, \ics{month} and \ics{year} registers. In
594 addition, \styfmt{datetime} provides the registers:
595 \ics{currenthour}, \ics{currentminute} and \ics{currentsecond}.
596 Note that old distributions of \TeX\ will always have
597 \cs{currentsecond} set to zero.
598
599 \section{Configuration File}
600
601 As from Version 2.4, the \styfmt{datetime} package will read in settings
602 from the configuration file \texttt{datetime.cfg}, if it exists,
603 which will override the default package options. For example,
604 suppose you prefer a short date without the day of week by default,
605 you will need to create a file called \texttt{datetime.cfg} that
606 contains the line:
607 \begin{verbatim}
608 \shortdate\showdowfalse
609 \end{verbatim}
610 The file \texttt{datetime.cfg} should then go somewhere on the
611 \TeX\ path. Now all you need to do is:
612 \begin{verbatim}
613 \usepackage{datetime}
614 \end{verbatim}
615 without having to specify the \pkgopt{short} and
616 \pkgopt{nodayofweek} options.
617
618 You can also use this file to define and set your own date
619 styles. For example, you could create
620 a configuration file that has the following lines:
621 \begin{verbatim}
622 \newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR}
623 \dashdate
624 \end{verbatim}
625 Whenever you use the \styfmt{datetime} package, it will now
626 use this format by default.
627
628 \section{LaTeX2HTML styles}
629
630 \changes{2.43}{2005/02/25}{Added LaTeX2HTML support}%
631 \changes{2.44}{2005/03/03}{Fixed minor bugs in Perl scripts}
632 Version 2.43 and above of the \styfmt{datetime} bundle
633 supplies the LaTeX2HTML style file \texttt{datetime.perl}.
634 This file should be placed in a
635 directory searched by LaTeX2HTML. The following limitations
636 apply to the LaTeX2HTML styles:
637
638 \begin{itemize}
639 \item The configuration file \texttt{datetime.cfg}
640 is currently ignored. You can however
641 do:
642 \begin{verbatim}
643 \usepackage{datetime}
644 \html{\input{datetime.cfg}}
645 \end{verbatim}
646 This, I agree, is an unpleasant cludge.
647
648 \item The commands \cs{monthname}\meta{language} are not
649 implemented.
650
651 \item Some of the languages are not implemented.
652
653 \item The package option \pkgopt{nodate} is not implemented.
654
655 \end{itemize}
656
657 \section{Troubleshooting}
658
659 There is a \sty{datetime} FAQ available at:
660 \url{http://www.dickimaw-books.com/faqs/datetimefaq.html}.
661
662 \StopEventually{\phantomsection
663 \addcontentsline{toc}{section}{Index}\PrintIndex
664 }
665
666 \end{document}