%%
%% This is file `isodateo.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% isodateo.dtx  (with options: `package')
%% 
%%   isodate package
%% 
%%   Copyright  2000--2010 Harald Harders
%% 
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%% 
%%   h.harders@tu-bs.de
%% 
\def\packagename{isodateo}
\def\fileversion{1.06a}
\def\filedate{2004/02/12}
\def\docdate{2000/08/08}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{isodateo}[\filedate]
\RequirePackage{ifthen}
\RequirePackage{calc}
\IfFileExists{substr.sty}{\RequirePackage{substr}%
 }{\PackageError{isodateo.sty}{Package file substr.sty not found}
   {This version of isodateo.sty needs the package substr.sty.^^J%
     You can download it from CTAN:/macros/latex/contrib/substr/^^J%
     E.g. one CTAN node is ftp.dante.de.
     Install substr.sty into your TeX tree.}}
\AtBeginDocument{%
  \@ifpackageloaded{babel}{}{%
    \@ifpackageloaded{german}{}{%
      \@ifpackageloaded{ngerman}{}{%
        \let\dateamerican\today%
        \setboolean{isodate@american}{true}%
        \def\iflanguage#1#2#3{\ifthenelse{%
            \equal{#1}{english}\or%
            \equal{#1}{american}\or%
            \equal{#1}{USenglish}%
            }{#2}{#3}}%
        }}}}
\newboolean{isodate@american}%
\DeclareOption{iso}{\AtBeginDocument{\isodate}}
\DeclareOption{num}{\AtBeginDocument{\numdate}}
\DeclareOption{short}{\AtBeginDocument{\shortdate}}
\DeclareOption{TeX}{\AtBeginDocument{\TeXdate}}
\DeclareOption{orig}{\AtBeginDocument{\origdate}}
\ExecuteOptions{orig}
\ProcessOptions
\def\dday{\ifthenelse{\number\day<10}{0}{}\number\day}
\def\dmonth{\ifthenelse{\number\month<10}{0}{}\number\month}
\DeclareRobustCommand*{\num@today}[1]{%
  \iflanguage{german}{\dday.\,\dmonth.#1}{%
    \iflanguage{austrian}{\dday.\,\dmonth.#1}{%
      \iflanguage{ngerman}{\dday.\,\dmonth.#1}{%
        \iflanguage{naustrian}{\dday.\,\dmonth.#1}{%
          \iflanguage{english}{%
            \ifthenelse{\boolean{isodate@american}}{%
              \dmonth/\dday/}{\dday/\dmonth/}}{%
  \dday/\dmonth/}}}}}%
}
\DeclareRobustCommand*{\numdate}{%
  \origdate%
  \setboolean{isodate@american}{false}%
  \iflanguage{american}{\IfCharInString{,}{\today}{%
    \setboolean{isodate@american}{true}}{}}{}%
  \gdef\today{%
    \num@today{~}%
    \number\year}}
\newcounter{yeartwo}
\DeclareRobustCommand*{\shortdate}{%
  \origdate%
  \setboolean{isodate@american}{false}%
  \iflanguage{american}{\IfCharInString{,}{\today}{%
    \setboolean{isodate@american}{true}}{}}{}%
  \gdef\today{%
    \num@today{\,}%
    \setcounter{yeartwo}{\number\year}%
    \whiledo{\theyeartwo>99}{\setcounter{yeartwo}{\theyeartwo-100}}{}%
    \ifthenelse{\number\theyeartwo<10}{0}{}\theyeartwo}}
\DeclareRobustCommand*{\isodate}{%
  \gdef\today{%
    \number\year\iso@isodash%
    \ifthenelse{\number\month<10}{0}{}\number\month\iso@isodash%
    \ifthenelse{\number\day<10}{0}{}\number\day}}
\def\iso@isodash{-}%
\DeclareRobustCommand*{\isodash}[1]{\def\iso@isodash{#1}}%
\DeclareRobustCommand*{\origdate}{\csname date\languagename\endcsname}
\DeclareRobustCommand*{\TeXdate}{%
  \gdef\today{%
    \number\year/%
    \ifthenelse{\number\month<10}{0}{}\number\month/%
    \ifthenelse{\number\day<10}{0}{}\number\day}}
\DeclareRobustCommand*{\iso@printdate}[3]{%
  \begingroup%
  \def\year{#1}%
  \def\month{#2}%
  \def\day{#3}%
  \today%
  \endgroup%
}
\newcounter{iso@slash}
\newcounter{iso@minus}
\newcounter{iso@dot}
\DeclareRobustCommand*{\printdate}[1]{%
  \expandafter\iso@expafterprintdate\expandafter{#1}}%
\DeclareRobustCommand*{\iso@expafterprintdate}[1]{%
  \SubStringsToCounter{iso@slash}{/}{#1}%
  \SubStringsToCounter{iso@minus}{-}{#1}%
  \SubStringsToCounter{iso@dot}{.}{#1}%
  \ifthenelse{\equal{\theiso@dot}{2}}{\printdatenumger{#1}}{%
    \ifthenelse{\equal{\theiso@minus}{2}}{\printdateiso{#1}}{%
      \ifthenelse{\equal{\theiso@slash}{2}}{\printdatenumeng{#1}}{%
        ????\iso@isodash ??\iso@isodash ??%
        \PackageError{isodateo}{unrecognized date format}{Use one of
          the following formats as macro argument:^^J%
          \space\space dd.mm.yyyy^^J%
          \space\space dd/mm/yyyy^^J%
          \space\space yyyy-mm-dd^^J%
          Don't use any spaces or commands like \protect\, or
          \protect~ inside the argument.}%
        }}}}
\DeclareRobustCommand*{\printdateiso}[1]{%
  \expandafter\iso@printdateiso #1\@empty}
\def\iso@printdateiso#1-#2-#3\@empty{\iso@printdate{#1}{#2}{#3}}
\DeclareRobustCommand*{\printdatenumger}[1]{%
  \expandafter\iso@printdatenumger #1\@empty}
\def\iso@printdatenumger#1.#2.#3\@empty{\iso@printdate{#3}{#2}{#1}}
\DeclareRobustCommand*{\printdatenumeng}[1]{%
  \expandafter\iso@printdatenumeng #1\@empty}
\def\iso@printdatenumeng#1/#2/#3\@empty{\iso@printdate{#3}{#2}{#1}}
\DeclareRobustCommand*{\printdateTeX}[1]{%
  \expandafter\iso@printdateTeX\expandafter{#1}}
\DeclareRobustCommand*{\iso@printdateTeX}[1]{%
  \SubStringsToCounter{iso@slash}{/}{#1}%
  \ifthenelse{\equal{\theiso@slash}{2}}%
  {\expandafter\iso@@printdateTeX #1\@empty}{%
    ????\iso@isodash ??\iso@isodash ??%
    \PackageError{isodateo}{unrecognized date format}{Use the format
      yyyy/mm/dd.^^J%
      Don't use any spaces or commands like \protect\, or
      \protect~ inside the argument.}}%
}
\def\iso@@printdateTeX#1/#2/#3\@empty{\iso@printdate{#1}{#2}{#3}}
\endinput
%%
%% End of file `isodateo.sty'.