From d72bcfb61c95b523b5bc8e1573c2f45f0dfa0464 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 24 Mar 2015 21:19:48 +0000 Subject: datetime2 (24mar15) git-svn-id: svn://tug.org/texlive/trunk@36615 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/datetime2/datetime2-calc.sty | 228 ++++ .../texmf-dist/tex/latex/datetime2/datetime2.sty | 1430 ++++++++++++++++++++ 2 files changed, 1658 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty create mode 100644 Master/texmf-dist/tex/latex/datetime2/datetime2.sty (limited to 'Master/texmf-dist/tex/latex/datetime2') diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty new file mode 100644 index 00000000000..006b1c4671d --- /dev/null +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty @@ -0,0 +1,228 @@ +%% +%% This is file `datetime2-calc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datetime2.dtx (with options: `datetime2-calc.sty,package') +%% +%% datetime2.dtx +%% Copyright 2015 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files datetime2.dtx and datetime2.ins and the derived files datetime2.sty, datetime2-calc.sty. +%% +%% \CharacterTable +%% {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 +%% 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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datetime2-calc}[2015/03/24 v1.0 (NLCT)] +\RequirePackage{pgfkeys} +\RequirePackage{pgfcalendar} +\newcount\@dtm@julianday +\def\@dtm@parsedate#1-#2-#3\@dtm@endparsedate{% + \pgfcalendardatetojulian{#1-#2-#3}{\@dtm@julianday}% + \pgfcalendarjuliantodate{\@dtm@julianday}{\@dtm@year}{\@dtm@month}{\@dtm@day}% + \pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% + \edef\@dtm@dow{\number\count@}% +} +\pgfcalendardatetojulian + {\@dtm@currentyear-\@dtm@currentmonth-\@dtm@currentday}% + {\@dtm@julianday}% +\pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% +\edef\@dtm@currentdow{\number\count@}% +\newrobustcmd*{\DTMsavejulianday}[2]{% + \pgfcalendarjuliantodate{#2}{\@dtm@year}{\@dtm@month}{\@dtm@day}% + \pgfcalendarjuliantoweekday{#2}{\count@}% + \csedef{@dtm@#1@dow}{\number\count@}% + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% + \ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% + \ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% + \ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% + \ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% +} +\newrobustcmd*{\DTMsaveddatetojulianday}[2]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \pgfcalendardatetojulian + {\csname @dtm@#1@year\endcsname + -\csname @dtm@#1@month\endcsname + -\csname @dtm@#1@day\endcsname} + {#2}% + }% +} +\newrobustcmd*{\DTMsaveddateoffsettojulianday}[3]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \pgfcalendardatetojulian + {\csname @dtm@#1@year\endcsname + -\csname @dtm@#1@month\endcsname + -\csname @dtm@#1@day\endcsname + +#2} + {#3}% + }% +} +\newrobustcmd*{\DTMifdate}[4]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \pgfcalendarifdate + {\csname @dtm@#1@year\endcsname + -\csname @dtm@#1@month\endcsname + -\csname @dtm@#1@day\endcsname} + {#2}{#3}{#4}% + }% +} +\newrobustcmd*{\DTMsaveddatediff}[3]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \ifcsundef{@dtm@#2@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \pgfcalendardatetojulian + {\csname @dtm@#1@year\endcsname + -\csname @dtm@#1@month\endcsname + -\csname @dtm@#1@day\endcsname} + {#3}% + \pgfcalendardatetojulian + {\csname @dtm@#2@year\endcsname + -\csname @dtm@#2@month\endcsname + -\csname @dtm@#2@day\endcsname} + {\@dtm@julianday}% + \advance#3 by -\@dtm@julianday\relax + } + }% +} +\newrobustcmd*{\DTMtozulu}[2]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2-calc}{Unknown date `#1'}{}% + }% + {% + \DTMsaveaszulutime{#2}% + {\DTMfetchyear{#1}}% + {\DTMfetchmonth{#1}}% + {\DTMfetchday{#1}}% + {\DTMfetchhour{#1}}% + {\DTMfetchminute{#1}}% + {\DTMfetchsecond{#1}}% + {\DTMfetchTZhour{#1}}% + {\DTMfetchTZminute{#1}}% + }% +} +\newrobustcmd*{\DTMsaveaszulutime}[9]{% + \edef\@dtm@year{\number#2}% + \edef\@dtm@month{\number#3}% + \edef\@dtm@day{\number#4}% + \edef\@dtm@hour{\number#5}% + \edef\@dtm@minute{\number#6}% + \edef\@dtm@second{\number#7}% + \edef\@dtm@TZhour{\number#8}% + \edef\@dtm@TZminute{\number#9}% + \pgfcalendardatetojulian{\@dtm@year-\@dtm@month-\@dtm@day}{\@dtm@julianday}% + \ifnum\@dtm@TZminute=0\relax + \else + \count@=\@dtm@minute\relax + \ifnum\@dtm@TZhour<0\relax + \advance\count@ by -\@dtm@TZminute\relax + \else + \advance\count@ by \@dtm@TZminute\relax + \fi + \edef\@dtm@minute{\number\count@}% + \ifnum\count@<0\relax + \advance\count@ by 60\relax + \edef\@dtm@minute{\number\count@}% + \ifnum\@dtm@hour=0\relax + \def\@dtm@hour{23}% + \advance\@dtm@julianday by -1\relax + \else + \count@ = \@dtm@hour\relax + \advance\count@ by -1\relax + \edef\@dtm@hour{\number\count@}% + \fi + \else + \ifnum\count@>59\relax + \advance\count@ by -60\relax + \edef\@dtm@minute{\number\count@}% + \count@ = \@dtm@hour\relax + \advance\count@ by 1\relax + \edef\@dtm@hour{\number\count@}% + \ifnum\thehour=24\relax + \def\thehour{00}% + \advance\@dtm@julianday by 1\relax + \fi + \fi + \fi + \fi + \ifnum\@dtm@TZhour=0\relax + \else + \count@=\@dtm@hour\relax + \advance\count@ by \@dtm@TZhour\relax + \ifnum\count@<0\relax + \advance\count@ by 24\relax + \edef\@dtm@hour{\number\count@}% + \advance\@dtm@julianday by -1\relax + \else + \ifnum\count@>23\relax + \advance\count@ by -24\relax + \edef\@dtm@hour{\number\count@}% + \advance\@dtm@julianday by 1\relax + \else + \edef\@dtm@hour{\number\count@}% + \fi + \fi + \fi + \pgfcalendarjuliantodate{\@dtm@julianday}{\@dtm@year}{\@dtm@month}{\@dtm@day}% + \pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% + \csedef{@dtm@#1@dow}{\number\count@}% + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \csdef{@dtm@#1@TZhour}{0}% + \csdef{@dtm@#1@TZminute}{0}% +} +\endinput +%% +%% End of file `datetime2-calc.sty'. diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty new file mode 100644 index 00000000000..f9fea5c72ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty @@ -0,0 +1,1430 @@ +%% +%% This is file `datetime2.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datetime2.dtx (with options: `datetime2.sty,package') +%% +%% datetime2.dtx +%% Copyright 2015 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files datetime2.dtx and datetime2.ins and the derived files datetime2.sty, datetime2-calc.sty. +%% +%% \CharacterTable +%% {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 +%% 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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datetime2}[2015/03/24 v1.0 (NLCT) date and time formats] +\RequirePackage{tracklang} +\RequirePackage{etoolbox} +\RequirePackage{xkeyval}[2006/11/18] +\newcommand*{\dtm@yearmonthsep}{-} +\newcommand*{\dtm@monthdaysep}{-} +\newcommand*{\dtm@dayyearsep}{-} +\newcommand*{\dtm@hourminsep}{:} +\newcommand*{\dtm@minsecsep}{:} +\newcommand*{\dtm@datetimesep}{\space}% +\newcommand*{\dtm@timezonesep}{} +\define@key{datetime2.sty}{datesep}{% + \renewcommand*{\dtm@yearmonthsep}{#1}% + \renewcommand*{\dtm@monthdaysep}{#1}% + \renewcommand*{\dtm@dayyearsep}{#1}% +} +\define@key{datetime2.sty}{yearmonthsep}{% + \renewcommand*{\dtm@yearmonthsep}{#1}% +} +\define@key{datetime2.sty}{monthdaysep}{% + \renewcommand*{\dtm@monthdaysep}{#1}% +} +\define@key{datetime2.sty}{dayyearsep}{% + \renewcommand*{\dtm@dayyearsep}{#1}% +} +\define@key{datetime2.sty}{timesep}{% + \renewcommand*{\dtm@hourminsep}{#1}% + \renewcommand*{\dtm@minsecsep}{#1}% +} +\define@key{datetime2.sty}{hourminsep}{% + \renewcommand*{\dtm@hourminsep}{#1}% +} +\define@key{datetime2.sty}{minsecsep}{% + \renewcommand*{\dtm@minsecsep}{#1}% +} +\define@key{datetime2.sty}{timezonesep}{% + \renewcommand*{\dtm@timezonesep}{#1}% +} +\define@key{datetime2.sty}{datetimesep}{% + \renewcommand*{\dtm@datetimesep}{#1}% +} +\define@boolkey{datetime2.sty}[DTM]{showseconds}[true]{} +\define@boolkey{datetime2.sty}[DTM]{showdate}[true]{} +\DTMshowdatetrue +\define@boolkey{datetime2.sty}[DTM]{showzone}[true]{} +\define@boolkey{datetime2.sty}[DTM]{showisoZ}[true]{} +\DTMshowisoZtrue +\ifdef\pdfcreationdate +{% + \DTMshowsecondstrue + \DTMshowzonetrue +}% +{% + \DTMshowsecondsfalse + \DTMshowzonefalse +}% +\define@boolkey{datetime2.sty}[DTM]{showzoneminutes}[true]{} +\DTMshowzoneminutestrue +\newcommand*{\DTMifcaseregional}[3]{#1} +\define@choicekey{datetime2.sty}{useregional}[\val\nr]% + {false,text,numeric,num}[text]% + {% + \ifcase\nr\relax + \renewcommand*{\DTMifcaseregional}[3]{##1}% + \or + \renewcommand*{\DTMifcaseregional}[3]{##2}% + \or + \renewcommand*{\DTMifcaseregional}[3]{##3}% + \or + \renewcommand*{\DTMifcaseregional}[3]{##3}% + \fi + } +\newcommand*{\@dtm@setusecalc}{% + \renewcommand*{\@dtm@usecalc}{\RequirePackage{datetime2-calc}}% +} +\newcommand*{\@dtm@usecalc}{} +\AtBeginDocument{% + \@ifpackageloaded{datetime2-calc}% + {% + \renewcommand*{\@dtm@setusecalc}{}% + }% + {% + \renewcommand*{\@dtm@setusecalc}{% + \PackageError{datetime2}{You must load `datetime2-calc' + package to use option `showdow'}{Try one of the following:^^J + pass `calc' option to `datetime2' package when you load it^^J + or move `showdow' option to `datetime2' package option list^^J + or move \string\DTLsetup\space to the preamble.}% + }% + }% +} +\DeclareOptionX{calc}{\@dtm@setusecalc} +\define@boolkey{datetime2.sty}[DTM]{showdow}[true]{% + \ifDTMshowdow \@dtm@setusecalc \fi +} +\DTMshowdowfalse +\newcommand*{\@dtm@warning}[1]{% + \if@dtm@warn + \PackageWarning{datetime2}{#1}% + \fi +} +\define@boolkey{datetime2.sty}[@dtm@]{warn}[true]{} +\@dtm@warntrue +\newcommand*{\@dtm@initialstyle}{} +\define@key{datetime2.sty}{style}{% + \renewcommand*{\@dtm@initialstyle}{#1}% + \ifstrempty{#1}% + {}% + {% + \renewcommand*{\DTMifcaseregional}[3]{##1}% + }% +} +\DeclareOptionX*{% + \TrackPredefinedDialect{\CurrentOption}% + \renewcommand*{\DTMifcaseregional}[3]{#2}% +} +\ProcessOptionsX +\disable@keys{datetime2.sty}{calc} +\disable@keys{datetime2.sty}{style} +\newcommand*{\DTMsetup}[1]{% + \def\@dtm@usecalc{}% + \setkeys{datetime2.sty}{#1}% + \@dtm@usecalc +} +\def\@dtm@parsedate#1-#2-#3\@dtm@endparsedate{% + \edef\@dtm@year{\number#1}% + \edef\@dtm@month{\number#2}% + \edef\@dtm@day{\number#3}% + \def\@dtm@dow{-1}% +} +\def\@dtm@parsetime#1:#2:#3\@dtm@endparsetime{% + \edef\@dtm@hour{\number#1}% + \edef\@dtm@minute{\number#2}% + \edef\@dtm@second{\number#3}% +} +\def\@dtm@parsetimezn#1:#2:#3 #4\@dtm@endparsetimezn{% + \@dtm@parsetime#1:#2:#3\@dtm@endparsetime + \@dtm@parsezone{#4}% +} +\newcommand*{\@dtm@parsezone}[1]{% + \ifstrequal{#1}{Z}% + {% + \def\@dtm@timezonehour{+00}% + \def\@dtm@timezoneminute{00}% + }% + {% + \@dtm@parse@zone#1\@dtm@endparse@zone + }% +} +\def\@dtm@parse@zone#1:#2\@dtm@endparse@zone{% + \edef\@dtm@timezonehour{\number#1}% + \edef\@dtm@timezoneminute{\number#2}% +} +\def\@dtm@parsetimestamp#1-#2-#3T#4:#5:#6#7#8\@dtm@endparsetimestamp{% + \@dtm@parsedate#1-#2-#3\@dtm@endparsedate + \@dtm@parsetime#4:#5:#6#7\@dtm@endparsetime + \@dtm@parsezone{#8}% +} +\newcommand*{\DTMsavefilemoddate}[2]{% + \@dtm@warning{Your TeX engine doesn't support accessing + file modification dates}% + \cslet{@dtm@#1@year}{0}% + \cslet{@dtm@#1@month}{0}% + \cslet{@dtm@#1@day}{0}% + \cslet{@dtm@#1@dow}{-1}% + \cslet{@dtm@#1@hour}{0}% + \cslet{@dtm@#1@minute}{0}% + \cslet{@dtm@#1@second}{0}% + \cslet{@dtm@#1@TZhour}{0}% + \cslet{@dtm@#1@TZminute}{0}% +} +\ifdef\pdfcreationdate +{% + \def\@dtm@parsepdfdatetime#1:#2#3#4#5#6#7#8#9{% + \def\@dtm@year{#2#3#4#5}% + \def\@dtm@month{#6#7}% + \def\@dtm@day{#8#9}% + \@dtm@parsepdftime + } + \def\@dtm@parsepdftime#1#2#3#4#5#6#7\@dtm@endparsepdfdatetime{% + \def\@dtm@hour{#1#2}% + \def\@dtm@minute{#3#4}% + \def\@dtm@second{#5#6}% + \ifstrequal{#7}{Z}% + {% + \def\@dtm@timezonehour{00}% + \def\@dtm@timezoneminute{00}% + }% + {% + \@dtm@parsepdftimezone#7% + }% + } + \def\@dtm@parsepdftimezone#1'#2'{% + \def\@dtm@timezonehour{#1}% + \def\@dtm@timezoneminute{#2}% + }% + \expandafter\@dtm@parsepdfdatetime\pdfcreationdate\@dtm@endparsepdfdatetime + \let\@dtm@currentyear\@dtm@year + \let\@dtm@currentmonth\@dtm@month + \let\@dtm@currentday\@dtm@day + \let\@dtm@currenthour\@dtm@hour + \let\@dtm@currentminute\@dtm@minute + \let\@dtm@currentsecond\@dtm@second + \let\@dtm@currenttimezonehour\@dtm@timezonehour + \let\@dtm@currenttimezoneminute\@dtm@timezoneminute + \ifdef\pdffilemoddate + {% + \renewcommand*{\DTMsavefilemoddate}[2]{% + \expandafter\@dtm@parsepdfdatetime\pdffilemoddate{#2}\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% + } + }% + {% + \ifdef\directlua + { + \renewcommand*{\DTMsavefilemoddate}[2]{% + \expandafter\@dtm@parseluadatetime + \directlua{tex.print(os.date( + "\expandafter\@gobble\string\%Y-% + \expandafter\@gobble\string\%m-% + \expandafter\@gobble\string\%d-% + \expandafter\@gobble\string\%w + \expandafter\@gobble\string\%H:% + \expandafter\@gobble\string\%M:% + \expandafter\@gobble\string\%S + \expandafter\@gobble\string\%z", + lfs.attributes("#2").modification))}% + \@dtm@endparseluadatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@TZhour}% + \cslet{@dtm@#1@TZminute}{\@dtm@TZminute}% + } + \def\@dtm@parseluadatetime#1-#2-#3-#4 #5:#6:#7 #8\@dtm@endparseluadatetime{% + \edef\@dtm@year{\number#1}% + \edef\@dtm@month{\number#2}% + \edef\@dtm@day{\number#3}% + \edef\@dtm@dow{\number#4}% + \edef\@dtm@hour{\number#5}% + \edef\@dtm@minute{\number#6}% + \edef\@dtm@second{\number#7}% + \@dtm@parseluatimezone#8000000\@dtm@endparseluatimezone + } + \def\@dtm@parseluatimezone#1#2#3#4#5#6{% + \ifstrequal{#1}{+}% + {% + \def\@dtm@TZhour{#1#2#3}% + \ifstrequal{#4}{:}% + {% + \def\@dtm@TZminute{#5#6}% + }% + {% + \def\@dtm@TZminute{#4#5}% + }% + }% + {% + \ifstrequal{#1}{-}% + {% + \def\@dtm@TZhour{#1#2#3}% + \ifstrequal{#4}{:}% + {% + \def\@dtm@TZminute{#5#6}% + }% + {% + \def\@dtm@TZminute{#4#5}% + }% + }% + {% + \ifstrequal{#1}{Z}% + {% + \def\@dtm@TZhour{0}% + \def\@dtm@TZminute{0}% + }% + {% + \def\@dtm@TZhour{#1#2}% + \ifstrequal{#3}{:}% + {% + \def\@dtm@TZminute{#4#5}% + }% + {% + \def\@dtm@TZminute{#3#4}% + }% + }% + }% + }% + \@@dtm@parseluatimezone + } + \def\@@dtm@parseluatimezone#1\@dtm@endparseluatimezone{% + } + } + {} + }% +}% +{% + \count@=\time\relax + \divide\count@ by 60\relax + \edef\@dtm@currenthour{\number\count@}% + \multiply\count@ by -60\relax + \advance\count@ by \time\relax + \edef\@dtm@currentminute{\number\count@}% + \newcommand*{\@dtm@currentsecond}{00}% + \newcommand\@dtm@currenttimezonehour{00}% + \newcommand\@dtm@currenttimezoneminute{00}% + \edef\@dtm@currentyear{\number\year}% + \edef\@dtm@currentmonth{\number\month}% + \edef\@dtm@currentday{\number\day}% +} +\robustify\DTMsavefilemoddate +\newcommand*{\@dtm@currentdow}{-1} +\newcommand*{\DTMsetcurrentzone}[2]{% + \renewcommand\@dtm@currenttimezonehour{#1}% + \renewcommand\@dtm@currenttimezoneminute{#2}% +} +\renewcommand*{\today}{% + \DTMdisplaydate + {\@dtm@currentyear}% + {\@dtm@currentmonth}% + {\@dtm@currentday}% + {\@dtm@currentdow}% +} +\newcommand*{\Today}{% + \DTMDisplaydate + {\@dtm@currentyear}% + {\@dtm@currentmonth}% + {\@dtm@currentday}% + {\@dtm@currentdow}% +} +\newcommand*\DTMdisplaydate[4]{% + \number#1\dtm@yearmonthsep\DTMtwodigits{#2}\dtm@monthdaysep\DTMtwodigits{#3}% +}% +\newcommand*{\DTMDisplaydate}{\DTMdisplaydate} +\newrobustcmd*{\DTMdate}[1]{% + \expandafter\@dtm@parsedate#1\@dtm@endparsedate + \DTMdisplaydate{\@dtm@year}{\@dtm@month}{\@dtm@day}{\@dtm@dow}% +} +\newrobustcmd*{\DTMDate}[1]{% + \expandafter\@dtm@parsedate#1\@dtm@endparsedate + \DTMDisplaydate{\@dtm@year}{\@dtm@month}{\@dtm@day}{\@dtm@dow}% +} +\newcommand*{\DTMcurrenttime}{% + \DTMdisplaytime + {\@dtm@currenthour}% + {\@dtm@currentminute}% + {\@dtm@currentsecond}% +} +\newcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{#1}\dtm@hourminsep\DTMtwodigits{#2}% + \ifDTMshowseconds\dtm@minsecsep\DTMtwodigits{#3}\fi +}% +\newrobustcmd*{\DTMtime}[1]{% + \@dtm@parsetime#1\@dtm@endparsetime + \DTMdisplaytime{\@dtm@hour}{\@dtm@minute}{\@dtm@second}% +} +\newcommand*{\DTMcurrentzone}{% + \DTMdisplayzone + {\@dtm@currenttimezonehour}% + {\@dtm@currenttimezoneminute}% +} +\newcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{#1}{0}} + and test{\ifnumequal{#2}{0}} + }% + {% + Z% + }% + {% + \ifnum#1<0\else+\fi\DTMtwodigits{#1}% + \ifDTMshowzoneminutes\dtm@hourminsep\DTMtwodigits{#2}\fi + }% +} +\newcommand*{\DTMnow}{% + \DTMdisplay + {\@dtm@currentyear} + {\@dtm@currentmonth} + {\@dtm@currentday} + {\@dtm@currentdow} + {\@dtm@currenthour}% + {\@dtm@currentminute}% + {\@dtm@currentsecond}% + {\@dtm@currenttimezonehour}% + {\@dtm@currenttimezoneminute}% +} +\newcommand*{\DTMNow}{% + \DTMDisplay + {\@dtm@currentyear} + {\@dtm@currentmonth} + {\@dtm@currentday} + {\@dtm@currentdow} + {\@dtm@currenthour}% + {\@dtm@currentminute}% + {\@dtm@currentsecond}% + {\@dtm@currenttimezonehour}% + {\@dtm@currenttimezoneminute}% +} +\newcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{#1}{#2}{#3}{#4}% + \dtm@datetimesep + \fi + \DTMdisplaytime + {#5}% + {#6}% + {#7}% + \ifDTMshowzone + \dtm@timezonesep + \DTMdisplayzone + {#8}% + {#9}% + \fi +} +\newcommand*{\DTMDisplay}{\DTMdisplay} +\newcommand*{\DTMtwodigits}[1]{% + \ifnum#1<0 + -\DTMtwodigits{-#1}% + \else + \ifnum#1<100 + \ifnum#1<10 + 0\number#1 + \else + \number#1 + \fi + \else + \ifnum\numexpr#1-(#1/100)*100<0 + \number\numexpr#1-((#1/100)-1)*100\relax + \else + \number\numexpr#1-(#1/100)*100\relax + \fi + \fi + \fi +} +\newcommand*{\DTMcentury}[1]{% + \ifnum#1<0 + -\DTMcentury{-#1}% + \else + \ifnum\numexpr#1-(#1/100)*100<1 + \number\numexpr#1/100\relax + \else + \number\numexpr(#1/100)+1\relax + \fi + \fi +} +\newcommand*{\DTMdivhundred}[1]{% + \ifnum#1<0 + -\DTMdivhundred{-#1}% + \else + \ifnum\numexpr#1-(#1/100)*100<0 + \number\numexpr(#1)/100-1\relax + \else + \number\numexpr((#1)/100)\relax + \fi + \fi +} +\newcommand*{\DTMtexorpdfstring}[2]{#1} +\AtBeginDocument{% + \@ifpackageloaded{hyperref}% + {% + \renewcommand*{\DTMtexorpdfstring}{\texorpdfstring}% + }% + {}% +} +\newcommand*{\DTMsep}[1]{\csname dtm@#1sep\endcsname} +\newcommand*{\DTMnewdatestyle}[2]{% + \ifcsdef{@dtm@datestyle@#1}% + {% + \PackageError{datetime2}{Date style `#1' already exists}{}% + }% + {% + \csdef{@dtm@datestyle@#1}{#2}% + }% +} +\newcommand*{\DTMnewtimestyle}[2]{% + \ifcsdef{@dtm@timestyle@#1}% + {% + \PackageError{datetime2}{Time style `#1' already exists}{}% + }% + {% + \csdef{@dtm@timestyle@#1}{#2}% + }% +} +\newcommand*{\DTMnewzonestyle}[2]{% + \ifcsdef{@dtm@zonestyle@#1}% + {% + \PackageError{datetime2}{Zone style `#1' already exists}{}% + }% + {% + \csdef{@dtm@zonestyle@#1}{#2}% + }% +} +\newcommand*{\DTMdefzonemap}[3]{% + \csdef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}{#3}% +} +\newcommand*{\DTMusezonemapordefault}[2]{% + \ifcsundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% + {% + \ifnum#1<0\else+\fi + \DTMtwodigits{#1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{#2}\fi + }% + {\csname @dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}\endcsname}% +} +\newcommand*{\DTMusezonemap}[2]{% + \csname @dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}\endcsname +} +\newcommand*{\DTMhaszonemap}[4]{% + \ifcsundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}{#4}{#3}% +} +\newcommand*{\DTMclearmap}[2]{% + \csundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% +} +\newcommand*{\DTMshowmap}[2]{% + \csshow{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% +} +\newcommand*{\DTMresetzones}{} +\newcommand*{\DTMNatoZoneMaps}{% + \defzonemap{01}{00}{A}% Alpha time zone + \defzonemap{02}{00}{B}% Bravo time zone + \defzonemap{03}{00}{C}% Charlie time zone + \defzonemap{04}{00}{D}% Delta time zone + \defzonemap{05}{00}{E}% Echo time zone + \defzonemap{06}{00}{F}% Foxtrot time zone + \defzonemap{07}{00}{G}% Golf time zone + \defzonemap{08}{00}{H}% Hotel time zone + \defzonemap{09}{00}{I}% India time zone + \defzonemap{10}{00}{K}% Kilo time zone + \defzonemap{11}{00}{L}% Lima time zone + \defzonemap{12}{00}{M}% Mike time zone + \defzonemap{-01}{00}{N}% November time zone + \defzonemap{-02}{00}{O}% Oscar time zone + \defzonemap{-03}{00}{P}% Papa time zone + \defzonemap{-04}{00}{Q}% Quebec time zone + \defzonemap{-05}{00}{R}% Romeo time zone + \defzonemap{-06}{00}{S}% Sierra time zone + \defzonemap{-07}{00}{T}% Tango time zone + \defzonemap{-08}{00}{U}% Uniform time zone + \defzonemap{-09}{00}{V}% Victor time zone + \defzonemap{-10}{00}{W}% Whiskey time zone + \defzonemap{-11}{00}{X}% X-ray time zone + \defzonemap{-12}{00}{Y}% Yankee time zone + \defzonemap{00}{00}{Z}% Zulu time zone +} +\newcommand*{\DTMnewstyle}[5]{% + \ifcsdef{@dtm@style@#1}% + {% + \PackageError{datetime2}{Style `#1' already exists}{}% + }% + {% + \DTMnewdatestyle{#1}{#2}% + \DTMnewtimestyle{#1}{#3}% + \DTMnewzonestyle{#1}{#4}% + \csdef{@dtm@style@#1}{% + \csuse{@dtm@datestyle@#1}% + \csuse{@dtm@timestyle@#1}% + \csuse{@dtm@zonestyle@#1}% + #5% + }% + }% +} +\newrobustcmd*{\DTMsetdatestyle}[1]{% + \ifcsdef{@dtm@datestyle@#1}% + {\csuse{@dtm@datestyle@#1}}% + {% + \PackageError{datetime2}{Date style `#1' not defined}{}% + }% +} +\newrobustcmd*{\DTMsettimestyle}[1]{% + \ifcsdef{@dtm@timestyle@#1}% + {\csuse{@dtm@timestyle@#1}}% + {% + \PackageError{datetime2}{Time style `#1' not defined}{}% + }% +} +\newrobustcmd*{\DTMsetzonestyle}[1]{% + \ifcsdef{@dtm@zonestyle@#1}% + {\csuse{@dtm@zonestyle@#1}}% + {% + \PackageError{datetime2}{Zone style `#1' not defined}{}% + }% +} +\newrobustcmd*{\DTMsetstyle}[1]{% + \ifcsdef{@dtm@style@#1}% + {\csuse{@dtm@style@#1}}% + {% + \let\dtm@unknownstyle\@dtm@unknownstyle + \ifcsdef{@dtm@datestyle#1}% + {\csuse{@dtm@datestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% + {\@dtm@warning{No date style `#1' defined}}% + \ifcsdef{@dtm@timestyle#1}% + {\csuse{@dtm@timestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% + {\@dtm@warning{No time style `#1' defined}}% + \ifcsdef{@dtm@zonestyle#1}% + {\csuse{@dtm@zonestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% + {\@dtm@warning{No zone style `#1' defined}}% + \dtm@unknownstyle{#1}% + }% +} +\newcommand*{\@dtm@unknownstyle}[1]{% + \PackageError{datetime2}{Unknown style `#1'}{}% +} +\newcommand*{\@dtm@unknown@style}[1]{% + \@dtm@warning{No full style `#1' defined}{}% +} +\DTMnewstyle + {default}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##1\DTMsep{yearmonth}\DTMtwodigits{##2}% + \DTMsep{monthday}\DTMtwodigits{##3}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {iso}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##1-\DTMtwodigits{##2}-\DTMtwodigits{##3}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}:\DTMtwodigits{##2}% + \ifDTMshowseconds:\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes:\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + T% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {pdf}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + D:\number##1 % space intended + \DTMtwodigits{##2}\DTMtwodigits{##3}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMtwodigits{##2}\DTMtwodigits{##3}% + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}'\DTMtwodigits{##2}'% + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMdisplaytime{##5}{##6}{##7}% + \DTMdisplayzone{##8}{##9}% + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {yyyymd}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##1 + \DTMsep{yearmonth}% + \number##2 + \DTMsep{monthday}% + \number##3 + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {ddmmyyyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##3}\DTMsep{monthday}% + \DTMtwodigits{##2}\DTMsep{yearmonth}% + \number##1 + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {dmyyyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##3 + \DTMsep{monthday}% + \number##2 + \DTMsep{yearmonth}% + \number##1 + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {dmyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##3 % space intended + \DTMsep{monthday}% + \number##2 % space intended + \DTMsep{yearmonth}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {mmddyyyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##2}\DTMsep{monthday}% + \DTMtwodigits{##3}\DTMsep{dayyear}% + \number##1 + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {mdyyyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##2 % space intended + \DTMsep{monthday}% + \number##3 % space intended + \DTMsep{dayyear}% + \number##1 % space intended + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle + {mdyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \number##2 % space intended + \DTMsep{monthday}% + \number##3 % space intended + \DTMsep{dayyear}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewtimestyle + {hmmss}% label + {% + \renewcommand*\DTMdisplaytime[3]{% + \number##1 + \DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% +\DTMnewzonestyle + {map}% label + {% + \renewcommand*\DTMdisplaytime[3]{% + \DTMusezonemapordefault{##1}{##2}% + }% + }% +\DTMnewzonestyle + {hhmm}% label + {% + \renewcommand*\DTMdisplaytime[3]{% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + } +\newrobustcmd*{\DTMsavedate}[2]{% + \expandafter\@dtm@parsedate#2\@dtm@endparsedate + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% + \ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% + \ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% + \ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% + \ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% +} +\newrobustcmd*{\DTMsavenoparsedate}[5]{% + \csedef{@dtm@#1@year}{\number#2}% + \csedef{@dtm@#1@month}{\number#3}% + \csedef{@dtm@#1@day}{\number#4}% + \csedef{@dtm@#1@dow}{\number#5}% + \ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% + \ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% + \ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% + \ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% + \ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% +} +\newrobustcmd*{\DTMsavetime}[2]{% + \expandafter\@dtm@parsetime#2\@dtm@endparsetime + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \ifcsundef{@dtm@#1@year}{\csdef{@dtm@#1@year}{0}}{}% + \ifcsundef{@dtm@#1@month}{\csdef{@dtm@#1@month}{0}}{}% + \ifcsundef{@dtm@#1@day}{\csdef{@dtm@#1@day}{0}}{}% + \ifcsundef{@dtm@#1@dow}{\csdef{@dtm@#1@dow}{-1}}{}% + \ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% + \ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% +} +\newrobustcmd*{\DTMsavetimezn}[2]{% + \expandafter\@dtm@parsetimezn#2\@dtm@endparsetimezn + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% + \ifcsundef{@dtm@#1@year}{\csdef{@dtm@#1@year}{0}}{}% + \ifcsundef{@dtm@#1@month}{\csdef{@dtm@#1@month}{0}}{}% + \ifcsundef{@dtm@#1@day}{\csdef{@dtm@#1@day}{0}}{}% + \ifcsundef{@dtm@#1@dow}{\csdef{@dtm@#1@dow}{-1}}{}% +} +\newrobustcmd*{\DTMsavetimestamp}[2]{% + \expandafter\@dtm@parsetimestamp#2\@dtm@endparsetimestamp + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% +} +\newrobustcmd{\DTMsavenow}[1]{% + \cslet{@dtm@#1@year}{\@dtm@currentyear}% + \cslet{@dtm@#1@month}{\@dtm@currentmonth}% + \cslet{@dtm@#1@day}{\@dtm@currentday}% + \cslet{@dtm@#1@dow}{\@dtm@currentdow}% + \cslet{@dtm@#1@hour}{\@dtm@currenthour}% + \cslet{@dtm@#1@minute}{\@dtm@currentminute}% + \cslet{@dtm@#1@second}{\@dtm@currentsecond}% + \cslet{@dtm@#1@TZhour}{\@dtm@currenttimezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@currenttimezoneminute}% +} +\newrobustcmd{\DTMmakeglobal}[1]{% + \global\csletcs{@dtm@#1@year}{@dtm@#1@year}% + \global\csletcs{@dtm@#1@month}{@dtm@#1@month}% + \global\csletcs{@dtm@#1@day}{@dtm@#1@day}% + \global\csletcs{@dtm@#1@dow}{@dtm@#1@dow}% + \global\csletcs{@dtm@#1@hour}{@dtm@#1@hour}% + \global\csletcs{@dtm@#1@minute}{@dtm@#1@minute}% + \global\csletcs{@dtm@#1@second}{@dtm@#1@second}% + \global\csletcs{@dtm@#1@TZhour}{@dtm@#1@TZhour}% + \global\csletcs{@dtm@#1@TZminute}{@dtm@#1@TZminute}% +} +\newcommand*{\DTMfetchyear}[1]{\csname @dtm@#1@year\endcsname} +\newcommand*{\DTMfetchmonth}[1]{\csname @dtm@#1@month\endcsname} +\newcommand*{\DTMfetchday}[1]{\csname @dtm@#1@day\endcsname} +\newcommand*{\DTMfetchdow}[1]{\csname @dtm@#1@dow\endcsname} +\newcommand*{\DTMfetchhour}[1]{\csname @dtm@#1@hour\endcsname} +\newcommand*{\DTMfetchminute}[1]{\csname @dtm@#1@minute\endcsname} +\newcommand*{\DTMfetchsecond}[1]{\csname @dtm@#1@second\endcsname} +\newcommand*{\DTMfetchTZhour}[1]{\csname @dtm@#1@TZhour\endcsname} +\newcommand*{\DTMfetchTZminute}[1]{\csname @dtm@#1@TZminute\endcsname} +\newcommand*\DTMusedate[1]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2}{Undefined date `#1'}{}% + }% + {% + \DTMdisplaydate + {\csname @dtm@#1@year\endcsname}% + {\csname @dtm@#1@month\endcsname}% + {\csname @dtm@#1@day\endcsname}% + {\csname @dtm@#1@dow\endcsname}% + }% +}% +\newcommand*\DTMUsedate[1]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2}{Undefined date `#1'}{}% + }% + {% + \DTMDisplaydate + {\csname @dtm@#1@year\endcsname}% + {\csname @dtm@#1@month\endcsname}% + {\csname @dtm@#1@day\endcsname}% + {\csname @dtm@#1@dow\endcsname}% + }% +}% +\newcommand*\DTMusetime[1]{% + \ifcsundef{@dtm@#1@hour}% + {% + \PackageError{datetime2}{Undefined time `#1'}{}% + }% + {% + \DTMdisplaytime + {\csname @dtm@#1@hour\endcsname}% + {\csname @dtm@#1@minute\endcsname}% + {\csname @dtm@#1@second\endcsname}% + }% +}% +\newcommand*\DTMusezone[1]{% + \ifcsundef{@dtm@#1@TZhour}% + {% + \PackageError{datetime2}{Undefined time `#1'}{}% + }% + {% + \DTMdisplayzone + {\csname @dtm@#1@TZhour\endcsname}% + {\csname @dtm@#1@TZminute\endcsname}% + }% +}% +\newcommand*\DTMuse[1]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2}{Undefined date-time `#1'}{}% + }% + {% + \DTMdisplay + {\csname @dtm@#1@year\endcsname}% + {\csname @dtm@#1@month\endcsname}% + {\csname @dtm@#1@day\endcsname}% + {\csname @dtm@#1@dow\endcsname}% + {\csname @dtm@#1@hour\endcsname}% + {\csname @dtm@#1@minute\endcsname}% + {\csname @dtm@#1@second\endcsname}% + {\csname @dtm@#1@TZhour\endcsname}% + {\csname @dtm@#1@TZminute\endcsname}% + }% +}% +\newcommand*\DTMUse[1]{% + \ifcsundef{@dtm@#1@year}% + {% + \PackageError{datetime2}{Undefined date-time `#1'}{}% + }% + {% + \DTMDisplay + {\csname @dtm@#1@year\endcsname}% + {\csname @dtm@#1@month\endcsname}% + {\csname @dtm@#1@day\endcsname}% + {\csname @dtm@#1@dow\endcsname}% + {\csname @dtm@#1@hour\endcsname}% + {\csname @dtm@#1@minute\endcsname}% + {\csname @dtm@#1@second\endcsname}% + {\csname @dtm@#1@TZhour\endcsname}% + {\csname @dtm@#1@TZminute\endcsname}% + }% +}% +\newcommand{\DTMifsaveddate}[3]{% + \ifcsundef{@dtm@#1@year}{#3}{#2}% +} +\newcommand*{\@dtm@requiremodule}[1]{% + \IfTrackedLanguageFileExists{#1}% + {datetime2-}% prefix + {.ldf}% suffix + {% + \RequireDateTimeModule{\CurrentTrackedTag}% + }% + {% + \@dtm@warning{Date-Time Language Module `#1' not installed}% + }% +} +\newcommand*{\@dtm@loadedregions}{} +\newcommand*{\RequireDateTimeModule}[1]{% + \ifundef\CurrentTrackedDialect + {% + \PackageError{datetime2}% + {\string\RequireDateTimeModule\space not permitted here}% + {This command is only permitted inside datetime2 language + modules.}% + }% + {% + \ifcsundef{ver@datetime2-#1.ldf}% + {% + \input{datetime2-#1.ldf}% + \ifdefempty\@dtm@loadedregions + {% + \edef\@dtm@loadedregions{#1}% + }% + {% + \edef\@dtm@loadedregions{\@dtm@loadedregions,#1}% + }% + }% + {}% + }% +} +\newcommand*{\ProvidesDateTimeModule}[1]{% + \ProvidesFile{datetime2-#1.ldf}% +} +\newcommand*{\DTMdefkey}[1]{\define@key[dtm]{#1}} +\newcommand*{\DTMdefchoicekey}[1]{\define@choicekey[dtm]{#1}} +\newcommand*{\DTMdefboolkey}[1]{\define@boolkey[dtm]{#1}} +\newcommand*{\DTMifbool}[4]{\ifbool{dtm@#1@#2}{#3}{#4}} +\newcommand*{\DTMsetbool}[3]{\setbool{dtm@#1@#2}{#3}} +\newcommand*{\DTMlangsetup}[2][\@dtm@loadedregions]{% + \@for\@dtm@region:=#1\do{% + \setkeys*+[dtm]{\@dtm@region}{#2}% + \ifdefempty\XKV@rm{}% + {% + \@dtm@warning{Region `\@dtm@region' has ignored + \MessageBreak the following settings:\MessageBreak + \XKV@rm + ^^J}% + }% + }% +} +\AnyTrackedLanguages +{% + \ForEachTrackedDialect{\this@dialect}% + {% + \@dtm@requiremodule\this@dialect + }% +} +{% +} +\@dtm@usecalc +\ifdefempty\@dtm@initialstyle{}{\DTMsetstyle{\@dtm@initialstyle}} +\endinput +%% +%% End of file `datetime2.sty'. -- cgit v1.2.3