summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex
blob: 483c1a2534958bd5bac59bbb6918048d01dbcfda (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
% ======================================================================
% scrdatetime.tex
% Copyright (c) Markus Kohm, 2001-2007
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3b of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3b or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in manifest.txt.
% ----------------------------------------------------------------------
% scrdatetime.tex
% Copyright (c) Markus Kohm, 2001-2007
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3b, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3b ist Teil aller Verteilungen von LaTeX
% Version 2005/12/01 oder spaeter und dieses Werks.
%
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
% (allein durch den Autor verwaltet).
%
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
% 
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
%
% Chapter about scrpage2 of the KOMA-Script guide
% Maintained by Markus Kohm
%
% ----------------------------------------------------------------------
%
% Kapitel über scrpage2 in der KOMA-Script-Anleitung
% Verwaltet von Markus Kohm
%
% ============================================================================

\ProvidesFile{scrdatetime.tex}[{2005/11/27 KOMA-Script guide (chapter:
  scrdate, scrtime)}]
% Date of translated german file: 2005-11-27

\chapter{Week-Day and Time Using \Package{scrdate} and \Package{scrtime}}
\labelbase{datetime}

There are two packages at \KOMAScript{} to improve and extend the
handling of date\Index{date} and time\Index{time}. So you have not
only the standard commands \Macro{today} and \Macro{date}. Like all
the other packages from \KOMAScript{} bundle these two packages may be used
not only with \KOMAScript{} classes but also with standard and many
other classes.

\section{The Name of the Current Day of Week Using \Package{scrdate}}
\label{sec:sec:datetime.scrdate}
\BeginIndex{Package}{scrdate}

The first problem is the question about the current day of week. The answer
may be given by the package \Package{scrdate}.

\begin{Declaration}
  \Macro{todaysname}
\end{Declaration}%
\BeginIndex{Cmd}{todaysname}%
You should know, that you may get the current date with
\Macro{today}\IndexCmd{today} in a language dependend
spelling. \Package{scrdate} offers you the command \Macro{todaysname}. This
results in the name of the current day of week in a language dependend
spelling.

\begin{Example}
  At your document you want to show the name of the week-day at which
  the \File{dvi}-file was generated using \LaTeX. To do this, you
  write:
\begin{lstlisting}
  I've done the \LaTeX-run of this document on a \todaysname.
\end{lstlisting}
  This will result in e.g.:
  \begin{quote}
    I've done the \LaTeX-run of this document on a \todaysname.
  \end{quote}
\end{Example}

Note that the package isn't able to decline. The known terms are the nominativ
singular that may be used e.g. at the date of a letter. For this the example
above is correct only at some languages.

\begin{Explain}
  \textbf{Tip:} The names of the week-days are saved in
  capitalization. So the first letter is a capital letter, all the
  others are small letters. But at some languages you also need the
  names with a first letter in lower case. You may achieve this using
  the standard \LaTeX{} command \Macro{MakeLowercase}. You simply have
  to write \Macro{MakeLowercase}\PParameter{\Macro{todaysname}}.
\end{Explain}
\EndIndex{Cmd}{todaysname}

\begin{Declaration}
  \Macro{nameday}\Parameter{name}
\end{Declaration}%
\BeginIndex{Cmd}{nameday}%
You should know, that you may change the output of \Macro{today} using
\Macro{date}\IndexCmd{date}. In a analogous way you can change the
output of \Macro{todaysname} using \Macro{nameday} into \PName{name}.
\begin{Example}
  You're changing the current date into a fix value using
  \Macro{date}. You are not interested in the name of the day, but
  you want to show, that it is a workday. So you set:
\begin{lstlisting}
  \nameday{workday}
\end{lstlisting}
  After this the previous example will result in:
  \begin{quote}
    I've done the \LaTeX-run of this document on a workday.
  \end{quote}
\end{Example}
\EndIndex{Cmd}{nameday}

Package \Package{scrdate} knows the languages english (english, american,
USenglish, UKenglish and british), german (german, ngerman and austrian),
french, italian, spanish, croatian, and finnish. If you want to configure it
for other languages, see \File{scrdate.dtx}.

At current implementation it doesn't matter, if you're loading
\Package{scrdate} before or after
\Package{german}\IndexPackage{german},
\Package{ngerman}\IndexPackage{ngerman},
\Package{babel}\IndexPackage{babel} or similar packages. The current
language will be setup at \Macro{begin}\PParameter{document}.

\begin{Explain}
  To explain it a little bit more exactly: While you are using a
  language selection, which works in a compatible way to
  \Package{babel}\IndexPackage{babel} or
  \Package{german}\IndexPackage{german}, the correct language will be
  used by \Package{scrdate}. If you are using another language
  selection you will get english caption names. At \File{scrdate.dtx}
  you will find the description of the \Package{scrdate}-commands for
  defining the names.
\end{Explain}
\EndIndex{Package}{scrdate}


\section{Getting the Time with Package \Package{scrtime}}
\label{sec:datetime.scrtime}
\BeginIndex{Package}{scrtime}

The second problem is the question about current time. The solution may be
found using package \Package{scrtime}.

\begin{Declaration}%
  \Macro{thistime}\OParameter{delimiter}\\
  \Macro{thistime*}\OParameter{delimiter}
\end{Declaration}%
\BeginIndex{Cmd}{thistime}\BeginIndex{Cmd}{thistime*}%
\Macro{thistime} results in the current\Index{time}.
The delimiter between the values of hour and minute 
can be given in the optional argument.
The default symbol of the delimiter is "\PValue{:}".

\Macro{thistime*} works in the same way as \Macro{thistime}.
The difference between both is that the value of the minute
using \Macro{thistime*} is not preceded with zero when its value
is less than 10, thus using \Macro{thistime} the minute-value
has always two places.
\begin{Example}
  The line
\begin{lstlisting}
  Your train departs at \thistime .
\end{lstlisting}
  results for example in:
  \begin{quote}
    Your train departs at \thistime .
  \end{quote}
  or:
  \begin{quote}
    Your train departs at 23:09.
  \end{quote}
  \bigskip
  In contrast to the prevous example a line like:
\begin{lstlisting}
  This day is already \thistime*[\ hours and\ ] minutes old.
\end{lstlisting}
  results in:
  \begin{quote}
    This day is already \thistime*[\ hours and\ ] minutes old.
  \end{quote}
  or:
  \begin{quote}
    This day is already 12 hours and 25 minutes old.
  \end{quote}
\end{Example}
\EndIndex{Cmd}{thistime}\EndIndex{Cmd}{thistime*}

\begin{Declaration}%
 \Macro{settime}\Parameter{Time}
\end{Declaration}%
\BeginIndex{Cmd}{settime}%
\Macro{settime} sets the output \Macro{thistime} and
\Macro{thistime*} on the value of \PName{Time}.
Afterwards the optinal parameter of \Macro{thistime} or
\Macro{thistime*} is ignored, since the result
of \Macro{thistime} or \Macro{thistime*}
was completely determined using \Macro{settime}.%
\EndIndex{Cmd}{settime}

\begin{Declaration}
  \Option{12h}\\
  \Option{24h}
\end{Declaration}%
\BeginIndex{Option}{12h}\BeginIndex{Option}{24h}%
Using the options \Option{12h} and \Option{24h} one can
select whether the result of \Macro{thistime} and \Macro{thistime*}
is in 12- or in 24-hour format. The default is \Option{24h}.%

The option has no effect on the results of
\Macro{thistime} and \Macro{thistime*} if \Macro{settime}
has been used.%
\EndIndex{Option}{12h}\EndIndex{Option}{24h}
\EndIndex{Package}{scrtime}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "../guide"
%%% End: