summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex
blob: f64ee91d37d7a64408be45b61203eb7b687b89bc (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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
% ======================================================================
% scrdatetime.tex
% Copyright (c) Markus Kohm, 2001-2015
%
% 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.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c 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-2015
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3c 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 ueber scrpage2 in der KOMA-Script-Anleitung
% Verwaltet von Markus Kohm
%
% ============================================================================

\KOMAProvidesFile{scrdatetime.tex}
                 [$Date: 2015-03-31 11:10:59 +0200 (Tue, 31 Mar 2015) $
                  KOMA-Script guide (chapter: scrdate, scrtime)]
\translator{Markus Kohm\and Gernot Hassenpflug}

% Date of translated German file: 2015-03-31

\chapter{The Day of the Week Using \Package{scrdate}}
\labelbase{scrdate}
\BeginIndex{Package}{scrdate}

With version~3.05a the functionality of this package enhanced a lot. Beside of
the current day of the week\Index{day>of the week} this package provides the
day of the week of every date of the Gregorian calendar now.

\begin{Declaration}
  \Macro{CenturyPart}\Parameter{year}\\%
  \Macro{DecadePart}\Parameter{year}%
\end{Declaration}%
\BeginIndex{Cmd}{CenturyPart}%
\BeginIndex{Cmd}{DecadePart}%
The\ChangedAt{v3.05a}{\Package{scrdate}} command \Macro{CenturyPart} offers
the value of the century digits\,---\,hundreds and thousands\,---\,of a
\PName{year}. The command \Macro{DecadePart} in difference offers the other
digits which are the units and tens. The number of digits of \PName{year} does
not care. The value may be assigned to a counter or may be used for
calculations, i.\,e., using \Macro{numexpr}\IndexCmd{numexpr}. For
output\textnote{Attention!} of an Arabic number of the value prefix it with
\Macro{the}
\IndexCmd{the}.

\begin{Example}
  You want to calculate and output the century of the current year.
\begin{lstcode}
  The year \the\year\ is the year \the\DecadePart{\year}
  of the \engord{\numexpr\CenturyPart{\year}+1\relax} century.
\end{lstcode}
  The result would be:
  \begin{quote}
    The year \the\year\ is the year \the\DecadePart{\year}
    of the \engordnumber{\numexpr\CenturyPart{\year}+1\relax} century.
  \end{quote}
  Package \Package{engord}\IndexPackage{engord} has been used for this
  example. See \cite{package:engord} for more information.
\end{Example}

Please\textnote{Attention!} note, that within used method of counting the
year~2000 is the year~0\,---\,and therefore the first year\,---\,of the
21st~century.%
\EndIndex{Cmd}{DecadePart}%
\EndIndex{Cmd}{CenturyPart}%

\begin{Declaration}
  \Macro{DayNumber}\Parameter{year}\Parameter{month}\Parameter{day}\\%
  \Macro{ISODayNumber}\Parameter{ISO-date}%
\end{Declaration}%
\BeginIndex{Cmd}{DayNumber}%
\BeginIndex{Cmd}{ISODayNumber}%
These\ChangedAt{v3.05a}{\Package{scrdate}} two commands offers the value of
the number of the day of the week\Index{day>of the week} of any date. The
differ only in the kind of date declaration. Command \Macro{DayNumber} needs
\PName{year}, \PName{month}, and \PName{day} as separate parameters. Command
\Macro{ISODayNumber} expects an \PName{ISO-date} as a single argument. The
expected format of the \PName{ISO-date} is:
\PName{year}\texttt{-}\PName{month}\texttt{-}\PName{day}. It does not matter
whether \PName{month} or \PName{day} have one or two digits. The result of
both commands may be assigned to a counter or used for calculations, i.\,e.,
using \Macro{numexpr}\IndexCmd{numexpr}. For output\textnote{Attention!} of an
Arabic number of the value prefix it with \Macro{the}\IndexCmd{the}.

\begin{Example}
  You want to know the number of the day of the week of the 1st~May~2027.
\begin{lstcode}
  The 1st~May~2027 has \the\ISODayNumber{2027-5-1}
  as the number of the day of the week.
\end{lstcode}
  The result will be:
  \begin{quote}
    The 1st~May~2027 has \the\ISODayNumber{2027-5-1}
    as the number of the day of the week.
  \end{quote}
\end{Example}

A special feature is to walk a number of days into future or past from a given
date.
\begin{Example}
  You want to know the number of the day of the week, that will be in 12~days
  and that will be 24~days before the 24th~December~2027.
\begin{lstcode}
  In 12~days the number of the day of the week
  will be \the\DayNumber{\year}{\month}{\day+12} and
  24~days before the 24th~December~2027 it will be
  \the\ISODayNumber{2027-12-24-24}.
\end{lstcode}
  The result may be, e.\,g.:
  \begin{quote}
    In 12~days the number of the day of the week
    will be \the\DayNumber{\year}{\month}{\day+12} and
    24~days before the 24th~December~2027 it will be
    \the\ISODayNumber{2027-12-24-24}.
  \end{quote}
\end{Example}

The days of the week are numbered: Sunday\,=\,0, Monday\,=\,1, Tuesday\,=\,2,
Wednesday\,=\,3, Thursday\,=\,4, Friday\,=\,5, and Saturday\,=\,6.%
%
\EndIndex{Cmd}{DayNumber}%
\EndIndex{Cmd}{ISODayNumber}%


\begin{Declaration}
  \Macro{DayNameByNumber}\Parameter{number of the day of the week}\\%
  \Macro{DayName}\Parameter{year}\Parameter{month}\Parameter{day}\\%
  \Macro{ISODayName}\Parameter{ISO-date}%
\end{Declaration}%
\BeginIndex{Cmd}{DayNameByNumber}%
\BeginIndex{Cmd}{DayName}%
\BeginIndex{Cmd}{ISODayName}%
Usually\ChangedAt{v3.05a}{\Package{scrdate}} you do not want to know the number
of the day of the week, but the name of the day of the week. Because of this,
the command \Macro{DayNameByNumber} offers the name of the day of the week
corresponding with a number. The number may be the result of \Macro{DayNumber}
or \Macro{ISODayNumber}. The two commands \Macro{DayName} and
\Macro{ISODayName} directly offer the name of the day of the week of a given
date.

\begin{Example}
  You want to know the name of the day of the week of the 24th~December~2027.
\begin{lstcode}
  Please pay you bill until \ISODayName{2027-12-24},
  24th~December~2027.
\end{lstcode}
  The result will be:
  \begin{quote}
    Please pay you bill until \ISODayName{2027-12-24},
    24th~December~2027.
  \end{quote}
\end{Example}

Again a special feature is to make some calculations inside the argument of
\Macro{DayName}.
\begin{Example}
  You want to know the names of the days of the week, that will be in 12~days
  and that will be 24~days before the 24th~December~2027.
\begin{lstcode}
  In 12~days the name of the day of the week
  will be \DayName{\year}{\month}{\day+12} and
  24~days before the 24th~December~2027 it will be
  \ISODayName{2027-12-24-24}. Nevertheless two weeks
  and three days after a Wednesday a
  \DayNameByNumber{3+2*7+3} will follow.
\end{lstcode}
  The result may be, e.\,g.:
  \begin{quote}
    In 12~days the name of the day of the week
    will be \DayName{\year}{\month}{\day+12} and
    24~days before the 24th~December~2027 it will be
    \ISODayName{2027-12-24-24}. Nevertheless two weeks
    and three days after a Wednesday a
    \DayNameByNumber{3+2*7+3} will follow.
  \end{quote}
\end{Example}%
%
\EndIndex{Cmd}{ISODayName}%
\EndIndex{Cmd}{DayName}%
\EndIndex{Cmd}{DayNameByNumber}%


\begin{Declaration}
  \Macro{ISOToday}\\%
  \Macro{IsoToday}\\
  \Macro{todaysname}\\%
  \Macro{todaysnumber}%
\end{Declaration}%
\BeginIndex{Cmd}{todaysname}%
\BeginIndex{Cmd}{todaysnumber}%
\BeginIndex{Cmd}{ISOToday}%
\BeginIndex{Cmd}{IsoToday}%
In the prior examples the current date have been given cumbersomely and
explicitly using the \TeX{} registers \Macro{year}\IndexCmd{year},
\Macro{month}\IndexCmd{month}, and \Macro{day}\IndexCmd{day}. The commands
\Macro{ISOToday}\ChangedAt{v3.05a}{\Package{scrdate}} and \Macro{IsoToday}
offers the current date in ISO-notation directly. These commands differ in the
number of digits for numbers less than 10 only. \Macro{ISOToday} prefixes
numbers less than 10 for the month and day with a 0. In opposite to this
\Macro{IsoToday} will show numbers less than 10 for the month and day with one
digit only. Command \Macro{todaysname} directly offers the name of the current
day of the week. Command \Macro{todaysnumber} offers the number of that name
instead. More information about usability of this value may be found at
previous description of \Macro{DayNumber} and \Macro{ISODayNumber}.

\begin{Example}
  I want to show you the name of the weekday in which this document has been
  type-set:
  \begin{lstlisting}
    I have done the {\LaTeX} run of this document 
    on a \todaysname.
  \end{lstlisting}
  This will result in, e.\,g.:
  \begin{quote}
    I have done the {\LaTeX} run of this document 
    on a \todaysname.
  \end{quote}
\end{Example}

Note that the package is not able to decline words. The known terms
are the nominative singular that may be used, e.\,g., in the date of a
letter. Given this limitation, the example above can work correctly
only for some languages.

\begin{Explain}
  The\textnote{Hint!} names of the weekdays are saved in capitalized form,
  i.\,e., the first letter is a capital letter, all the others are lowercase
  letters. But for some languages you may need the names completely in
  lowercase. You may achieve this using the standard {\LaTeX} command
  \Macro{MakeLowercase}\IndexCmd{MakeLowercase}%
  \important{\Macro{MakeLowercase}}, e.\,g.:
  % Umbruchkorrektur: listings
\begin{lstcode}[belowskip=\dp\strutbox]
  \MakeLowercase{\todaysname}
\end{lstcode}
  This converts the whole argument into lower case letters. Of course, this
  may be done also using previous described commands
  \Macro{DayNameByNumber}\IndexCmd{DayNameByNumber},
  \Macro{DayName}\IndexCmd{DayName} and
  \Macro{ISODayName}\IndexCmd{ISODayName}.%
\end{Explain}%
\EndIndex{Cmd}{IsoToday}%
\EndIndex{Cmd}{ISOToday}%
\EndIndex{Cmd}{todaysnumber}%
\EndIndex{Cmd}{todaysname}


\begin{Declaration}
  \Macro{nameday}\Parameter{name}
\end{Declaration}%
\BeginIndex{Cmd}{nameday}%
Analogous to how the output of \Macro{today} can be modified using
\Macro{date}\IndexCmd{date}, so the output of \Macro{todaysname} can
be changed to \PName{name} by using \Macro{nameday}.
\begin{Example}
  You change the current date to a fixed value using \Macro{date}. You
  are not interested in the actual name of the day, but want only 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}\nameday{workday}
    I have done the {\LaTeX} run of this document on a \todaysname.
  \end{quote}
\end{Example}
There's no such command for changing the result of
\Macro{ISOToday}\IndexCmd{ISOToday} or \Macro{IsoToday}\IndexCmd{IsoToday}.
\EndIndex{Cmd}{nameday}


\begin{Declaration}
  \Macro{newdaylanguage}\Parameter{language}\\
  \hphantom{\XMacro{newdaylanguage}}%
  \Parameter{Monday}\Parameter{Tuesday}\Parameter{Wednesday}%
  \Parameter{Thursday}\\
  \hphantom{\XMacro{newdaylanguage}}%
  \Parameter{Friday}\Parameter{Saturday}\Parameter{Sunday}%
\end{Declaration}
\BeginIndex{Cmd}{newdaylanguage}
Currently the package \Package{scrdate} knows the following languages:
\begin{itemize}
\item Croatian (\PValue{croatian}),
\item Czech (\PValue{czech}\ChangedAt{v3.13}{\Package{scrdate}}),
\item Danish (\PValue{danish}),
\item Dutch (\PValue{dutch}),
\item English (\PValue{american}\ChangedAt{v3.13}{\Package{scrdate}},
  \PValue{australian}, \PValue{british}, \PValue{canadian}, \PValue{english},
  \PValue{UKenglish}, and USenglish),
\item Finnish (\PValue{finnish}),
\item French (\PValue{acadian}, \PValue{canadien},
  \PValue{francais}\ChangedAt{v3.13}{\Package{scrdate}}, and \PValue{french}),
\item German (\PValue{austrian}\ChangedAt{v3.08b}{\Package{scrdate}},
  \PValue{german}, \PValue{naustrian}, \PValue{ngerman},
  \PValue{nswissgerman}, and
  \PValue{swissgerman}\ChangedAt{v3.13}{\Package{scrdate}}),
\item Italian (\PValue{italian}),
\item Norwegian (\PValue{norsk}),
\item Polish (\PValue{polish}\ChangedAt{v3.13}{\Package{scrdate}}),
\item Spanish (\PValue{spanish}),
\item Swedish (\PValue{swedish}).
\end{itemize}
If you want to configure it for other languages, you may use this command. The
first argument is the name of the language and the other arguments are the
names of the corresponding days.

In the current implementation it does not matter whether you load
\Package{scrdate} before or after
\Package{german}\IndexPackage{german},
\Package{ngerman}\IndexPackage{ngerman},
\Package{babel}\IndexPackage{babel} or similar packages. In both cases the
correct language will be used.

\begin{Explain}
  To explain 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{ngerman}\IndexPackage{ngerman}, the correct language will be used
  by \Package{scrdate}. If you are using another language selection you will
  get (US-)English names.
\end{Explain}

By the way: If you found a suitable definition for a language, that has not
been defined before, please mail it to the \KOMAScript{} author. There is a
good chance, that he will add support for the language to \Package{scrdate}.%
\EndIndex{Cmd}{newdaylanguage}%
%
\EndIndex{Package}{scrdate}


\chapter{Getting the Time with Package \Package{scrtime}}
\labelbase{scrtime}
\BeginIndex{Package}{scrtime}

This package provides an answer to the question of the current time. Since
version~3.05 this package uses the option interface already known from
the \KOMAScript{} classes and several other \KOMAScript{} packages. See for
example \autoref{sec:typearea.options} for more information.

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

\Macro{thistime*} works in almost the same way as \Macro{thistime}.
The only difference is that unlike with \Macro{thistime}, with
\Macro{thistime*} the value of the minute field is not preceded by a
zero when its value is less than 10. Thus, with \Macro{thistime} the
minute field 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 previous 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 of \Macro{thistime} and
\Macro{thistime*} to the value \PName{time}.  Now the optional
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}
  \KOption{12h}\PName{simple-switch}%
\end{Declaration}%
\BeginIndex{Option}{12h~=\PName{simple switch}}%
\BeginIndex{Option}{24h}%
With option \Option{12h}\ChangedAt{v3.05a}{\Package{scrtime}} one can select
whether the result of \Macro{thistime} and \Macro{thistime*} is in 12- or in
24-hour format. The option understands the values for simple-switch listed in
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}. The option
without a value is same like \OptionValue{12h}{true} and therefore
12-hour-format will be used. The default is \Option{24h}.

You may use this option either as a global option in the optional argument of
\Macro{documentclass}, as a package option in the optional argument of
\Macro{usepackage} or after loading the package using \Macro{KOMAoptions} or
\Macro{KOMAoption} (see, e.\,g., \autoref{sec:typearea.options},
\autopageref{desc:typearea.cmd.KOMAoptions}).  The option has no effect on the
results of \Macro{thistime} and \Macro{thistime*} if \Macro{settime} is used.

Only\textnote{Attention!} for compatibility with former releases of
\Package{scrtime} also option \Option{24h} will switch to 24-hour format if
used in the optional argument of \Macro{documentclass} or
\Macro{usepackage}. Nevertheless, you should not use this option any longer.%
\EndIndex{Option}{24h}%
\EndIndex{Option}{12h~=\PName{simple switch}}%
%
\EndIndex{Package}{scrtime}

\endinput

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