Debian Codegraph @

texmf-dist/doc/latex/datetime/samples/dt-sampl.tex

raw
1 %%
2 %% This is file `dt-sampl.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% datetime.dtx (with options: `dt-sampl.tex,package')
8 %%
9 %% datetime.dtx
10 %% Copyright 2015 Nicola Talbot
11 %%
12 %% This work may be distributed and/or modified under the
13 %% conditions of the LaTeX Project Public License, either version 1.3
14 %% of this license of (at your option) any later version.
15 %% The latest version of this license is in
16 %% http://www.latex-project.org/lppl.txt
17 %% and version 1.3 or later is part of all distributions of LaTeX
18 %% version 2005/12/01 or later.
19 %%
20 %% This work has the LPPL maintenance status `maintained'.
21 %%
22 %% The Current Maintainer of this work is Nicola Talbot.
23 %%
24 %% This work consists of the files datetime.dtx and datetime.ins and the derived files datetime-defaults.sty, datetime.sty, dt-american.def, dt-australian.def, dt-austrian.def, dt-bahasa.def, dt-basque.def, dt-breton.def, dt-british.def, dt-bulgarian.def, dt-canadian.def, dt-catalan.def, dt-croatian.def, dt-czech.def, dt-danish.def, dt-dutch.def, dt-esperanto.def, dt-estonian.def, dt-finnish.def, dt-french.def, dt-galician.def, dt-german.def, dt-greek.def, dt-hebrew.def, dt-icelandic.def, dt-irish.def, dt-italian.def, dt-latin.def, dt-lsorbian.def, dt-magyar.def, dt-naustrian.def, dt-newzealand.def, dt-ngerman.def, dt-norsk.def, dt-polish.def, dt-portuges.def, dt-romanian.def, dt-russian.def, dt-samin.def, dt-scottish.def, dt-serbian.def, dt-slovak.def, dt-slovene.def, dt-spanish.def, dt-swedish.def, dt-turkish.def, dt-UKenglish.def, dt-ukraineb.def, dt-USenglish.def, dt-usorbian.def, dt-welsh.def, dt-lang.tex, dt-sampl.tex, datetime.perl.
25 %%
26 %% \CharacterTable
27 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
28 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
29 %% Digits \0\1\2\3\4\5\6\7\8\9
30 %% Exclamation \! Double quote \" Hash (number) \#
31 %% Dollar \$ Percent \% Ampersand \&
32 %% Acute accent \' Left paren \( Right paren \)
33 %% Asterisk \* Plus \+ Comma \,
34 %% Minus \- Point \. Solidus \/
35 %% Colon \: Semicolon \; Less than \<
36 %% Equals \= Greater than \> Question mark \?
37 %% Commercial at \@ Left bracket \[ Backslash \\
38 %% Right bracket \] Circumflex \^ Underscore \_
39 %% Grave accent \` Left brace \{ Vertical bar \|
40 %% Right brace \} Tilde \~}
41 \documentclass[a4paper]{article}
42
43 \usepackage{ifpdf}
44 \usepackage{datetime}
45
46 \ifpdf
47 \pdfinfo{
48 /CreationDate (D:20040501215500Z)
49 /ModDate (D:\pdfcreationdate)
50 }
51 \fi
52
53 \padzeroes[8]
54
55 \newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR}
56 \newdateformat{usvardate}{\monthname[\THEMONTH]~\ordinaldate{\THEDAY}, \THEYEAR}
57 \newdateformat{mydate}{\ifshowdow \dayofweekname{\THEDAY}{\THEMONTH}{\THEYEAR} \fi
58 \THEDAY\ \monthname[\THEMONTH], \THEYEAR}
59 \newdateformat{yyyymmdd}{\THEYEAR\twodigit{\THEMONTH}\twodigit{\THEDAY}}
60 \newdateformat{ukvardate}{\THEDAY\ \monthname[\THEMONTH]\ \THEYEAR}
61
62 \newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}}
63 \newtimeformat{dashtime12}{\THEHOURXII-\twodigit{\THEMINUTE}}
64 \newtimeformat{hhmm}{\twodigit{\THEHOUR}\twodigit{\THEMINUTE}}
65
66 \begin{document}
67
68 \section{Date Formats}
69 Default: \today.
70
71 \begin{tabular}{ll}
72 \bfseries Declaration & \bfseries\verb|\today|\\
73 \verb|\longdate| & \longdate\today\\
74 \verb|\shortdate| & \shortdate\today\\
75 \verb|\yyyymmdddate| & \yyyymmdddate\today\\
76 \verb|\ddmmyyyydate| & \ddmmyyyydate\today\\
77 \verb|\dmyyyydate| & \dmyyyydate\today\\
78 \verb|\ddmmyydate| & \ddmmyydate\today\\
79 \verb|\dmyydate| & \dmyydate\today\\
80 \verb|\textdate| & \textdate\today\\
81 \verb|\usdate| & \usdate\today\\
82 \verb|\mmddyyyydate| & \mmddyyyydate\today\\
83 \verb|\mdyyyydate| & \mdyyyydate\today\\
84 \verb|\mmddyydate| & \mmddyydate\today\\
85 \verb|\mdyydate| & \mdyydate\today
86 \end{tabular}
87
88 \section{Time Formats}
89 Default: \currenttime.
90
91 \begin{tabular}{@{\ttfamily}ll}
92 \bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\
93 hhmmsstime & \settimeformat{hhmmsstime}\currenttime\\
94 xxivtime & \settimeformat{xxivtime}\currenttime\\
95 ampmtime & \settimeformat{ampmtime}\currenttime\\
96 oclock & \settimeformat{oclock}\currenttime
97 \end{tabular}
98
99 \section{Specific Date:}
100
101 \begin{tabular}{ll}
102 \bfseries Format & \bfseries \verb|\formatdate{1}{3}{2009}|\\
103 \verb|\longdate| & \longdate\formatdate{1}{3}{2000}\\
104 \verb|\shortdate| & \shortdate\formatdate{1}{3}{2000}\\
105 \verb|\yyyymmdddate| & \yyyymmdddate\formatdate{1}{3}{2000}\\
106 \verb|\ddmmyyyydate| & \ddmmyyyydate\formatdate{1}{3}{2000}\\
107 \verb|\dmyyyydate| & \dmyyyydate\formatdate{1}{3}{2000}\\
108 \verb|\ddmmyydate| & \ddmmyydate\formatdate{1}{3}{2000}\\
109 \verb|\dmyydate| & \dmyydate\formatdate{1}{3}{2000}\\
110 \verb|\textdate| & \textdate\formatdate{1}{3}{2000}\\
111 \verb|\usdate| & \usdate\formatdate{1}{3}{2000}\\
112 \verb|\mmddyyyydate| & \mmddyyyydate\formatdate{1}{3}{2000}\\
113 \verb|\mdyyyydate| & \mdyyyydate\formatdate{1}{3}{2000}\\
114 \verb|\mmddyydate| & \mmddyydate\formatdate{1}{3}{2000}\\
115 \verb|\mdyydate| & \mdyydate\formatdate{1}{3}{2000}
116 \end{tabular}
117
118 \section{Specific Time}
119
120 \begin{tabular}{@{\ttfamily}ll}
121 \bfseries\rmfamily Format & \bfseries \verb|\formattime{15}{45}{00}|\\
122 hhmmsstime & \settimeformat{hhmmsstime}\formattime{15}{45}{00}\\
123 xxivtime & \settimeformat{xxivtime}\formattime{15}{45}{00}\\
124 ampmtime & \settimeformat{ampmtime}\formattime{15}{45}{00}\\
125 oclock & \settimeformat{oclock}\formattime{15}{45}{00}
126 \end{tabular}
127
128 \vskip\baselineskip\noindent
129 \begin{tabular}{@{\ttfamily}ll}
130 \bfseries\rmfamily Format & \bfseries \verb|\formattime{0}{0}{0}|\\
131 hhmmsstime & \settimeformat{hhmmsstime}\formattime{0}{0}{0}\\
132 xxivtime & \settimeformat{xxivtime}\formattime{0}{0}{0}\\
133 ampmtime & \settimeformat{ampmtime}\formattime{0}{0}{0}\\
134 oclock & \settimeformat{oclock}\formattime{0}{0}{0}
135 \end{tabular}
136
137 \vskip\baselineskip\noindent
138 \begin{tabular}{@{\ttfamily}ll}
139 \bfseries\rmfamily Format & \bfseries \verb|\formattime{12}{0}{0}|\\
140 hhmmsstime & \settimeformat{hhmmsstime}\formattime{12}{0}{0}\\
141 xxivtime & \settimeformat{xxivtime}\formattime{12}{0}{0}\\
142 ampmtime & \settimeformat{ampmtime}\formattime{12}{0}{0}\\
143 oclock & \settimeformat{oclock}\formattime{12}{0}{0}
144 \end{tabular}
145
146 \section{Defining New Dates}
147
148 \begin{tabular}{ll}
149 \verb|\dashdate| & \dashdate\today\\
150 \verb|\usvardate| & \usvardate\today\\
151 \verb|\ukvardate| & \ukvardate\today\\
152 \verb|\mydate| & \mydate\today\\
153 \verb|\yyyymmdd| & \yyyymmdd\today\\
154 \verb|\dashdate| & \dashdate\formatdate{8}{3}{2000}\\
155 \verb|\usvardate| & \usvardate\formatdate{8}{3}{2000}\\
156 \verb|\mydate| & \mydate\formatdate{8}{3}{2000}\\
157 \verb|\yyyymmdd| & \yyyymmdd\formatdate{8}{3}{2000}
158 \end{tabular}
159
160 \section{Defining New Times}
161
162 \begin{tabular}{@{\ttfamily}ll}
163 \bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\
164 dottime & \settimeformat{dottime}\currenttime\\
165 dashtime12 & \settimeformat{dashtime12}\currenttime\\
166 hhmm & \settimeformat{hhmm}\currenttime
167 \end{tabular}
168
169 \end{document}
170 \endinput
171 %%
172 %% End of file `dt-sampl.tex'.