diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-22 00:09:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-22 00:09:38 +0000 |
commit | 03799d65499299079bb659eb8897228076096ce6 (patch) | |
tree | cb5273aa1411ce8f79c190e7c66ab5f526c4e071 /Master/texmf-dist/source/latex/datetime/datetime.dtx | |
parent | 57b42dc59a849d094c9acfa2c24623e10b922783 (diff) |
datetime 2.58 (21sep10)
git-svn-id: svn://tug.org/texlive/trunk@19834 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/datetime/datetime.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/datetime/datetime.dtx | 3302 |
1 files changed, 2840 insertions, 462 deletions
diff --git a/Master/texmf-dist/source/latex/datetime/datetime.dtx b/Master/texmf-dist/source/latex/datetime/datetime.dtx index e4f211f1572..8173974405b 100644 --- a/Master/texmf-dist/source/latex/datetime/datetime.dtx +++ b/Master/texmf-dist/source/latex/datetime/datetime.dtx @@ -1,13 +1,18 @@ %\iffalse % datetime.dtx generated using makedtx version 0.94b (c) Nicola Talbot % Command line args: +% -macrocode "datetime.perl" +% -setambles ".*\.perl=>\nopreamble\nopostamble" +% -comment "datetime.perl" +% -comment "dt-.+\.tex" % -src "(.+)\.(sty)=>\1.\2" % -src "(.+)\.(def)=>\1.\2" +% -src "(dt-.+)\.(tex)=>\1.\2" +% -src "datetime.perl\Z=>datetime.perl" % -doc "datetime-manual.tex" % -author "Nicola Talbot" -% -dir "source" % datetime -% Created on 2010/2/6 14:17 +% Created on 2010/9/21 10:02 %\fi %\iffalse %<*package> @@ -34,18 +39,18 @@ % \fi % \iffalse %<*driver> -\documentclass{ltxdoc} +\documentclass{nlctdoc} \usepackage[colorlinks, bookmarks, bookmarksopen, - pdfauthor={N.L.C. Talbot}, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, pdftitle={datetime.sty: A Date and Time Package}, pdfkeywords={date,time,LaTeX}]{hyperref} -\newcommand{\sty}[1]{\textsf{#1}} \begin{document} \DocInput{datetime.dtx} \end{document} @@ -54,46 +59,46 @@ %\RecordChanges %\OnlyDescription % -%\title{datetime.sty v2.57: Formatting Current Date and -%Time} +%\title{datetime.sty v2.58: +%Formatting Current Date and Time} % \author{Nicola L. C. Talbot\\[10pt] % School of Computing Sciences\\ % University of East Anglia\\ % Norwich. NR4 7TJ.\\ % United Kingdom.\\ % \url{http://theoval.cmp.uea.ac.uk/~nlct/}} -% \date{6th Feb 2010} +% \date{2010-09-21} % \maketitle % \tableofcontents % \section{Introduction} %\changes{1.0}{2000/08/08}{First release} %\changes{1.01}{2000/09/18}{Documentation added} -%The \sty{datetime} package is a \LaTeXe\ package that -%provides various different formats for \cs{today}, +%The \styfmt{datetime} package is a \LaTeXe\ package that +%provides various different formats for \ics{today}, %and provides commands for displaying the current time. %If you only want the %time commands but not the date changing commands, you can pass -%the option \texttt{nodate} to the package. +%the option \pkgopt{nodate} to the package. %\changes{2.3}{2004/05/01}{nodate package option added} % %\changes{2.41}{2004/10/22}{split package into two files: %datetime.sty and fmtcount.sty} -%Since version 2.4, the \sty{datetime} package has been -%separated into two packages: \sty{datetime} and +%Since version 2.4, the \styfmt{datetime} package has been +%separated into two packages: \styfmt{datetime} and %\sty{fmtcount}. When I originally created this package, -%I defined the commands, \cs{ordinal} etc which could be used +%I defined the commands, \ics{ordinal} etc which could be used %in the definition of \cs{today}. Since then, I have extended %the number of commands available that can be used to display the %value of a \LaTeX\ counter, however it seems more appropriate to %define all these counter-related commands in a separate package. %The \sty{fmtcount} package is now distributed separately -%from the \sty{datetime} package, and will also need to +%from the \styfmt{datetime} package, and will also need to %be installed. % %\changes{2.42}{2004/11/01}{made package compatible with babel} -%As from version 2.42, the \sty{datetime} package is now +%As from version 2.42, the \styfmt{datetime} package is now %compatible with \sty{babel}, however you must load the -%\sty{datetime} package \emph{after} the \sty{babel} package. +%\styfmt{datetime} package \emph{after} the \sty{babel} package. %For example: %\begin{verbatim} %\usepackage[francais]{babel} @@ -102,111 +107,148 @@ % % \section{Predefined Date Formats} % There are various declarations that change the effect of -%\cs{today}. The change can be localised by placing the +%\ics{today}. The change can be localised by placing the %declaration within a group. % +%As from version 2.43, the numerical date formats (such as +%\ics{ddmmyyyydate}) use the command +%\begin{definition}[\DescribeMacro{\dateseparator}] +%\cs{dateseparator} +%\end{definition} +%to separate the numbers. So, for example, if you want to hyphens +%instead of slashes, you can do: +%\begin{verbatim} +%\renewcommand{\dateseparator}{-} +%\end{verbatim} % -% \vspace{10pt}\noindent ISO format: -% \DescribeMacro{\yyyymmdddate} -% The declaration \verb"\yyyymmdddate" will redefine -%\verb"\today" to produce -% the current date displayed in the form 2000/03/08. (You can -%redefine \cs{dateseparator} to \texttt{-} to change to -%2000-03-08.) +%\subsection{ISO format} % -% \vspace{10pt}\noindent \meta{Day} \meta{Month} \meta{Year} formats:\\ -% \noindent\DescribeMacro{\longdate} -% The declaration \verb"\longdate" will redefine -%\verb"\today" to produce the current date displayed in the form -%Wednesday 8\textsuperscript{th} March, 2000 -% if the package option \texttt{dayofweek} is used, or +%\begin{definition}[\DescribeMacro{\yyyymmdddate}] +%\cs{yyyymmdddate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 2000/03/08. (You can redefine +%\ics{dateseparator} to \texttt{-} to change to 2000-03-08.) +% +%\subsection{\texorpdfstring{\meta{Day} \meta{Month} \meta{Year}}{Day Month Year} formats} +% +%\begin{definition}[\DescribeMacro{\longdate}] +%\cs{longdate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form Wednesday 8\textsuperscript{th} March, +%2000 if the package option \pkgopt{dayofweek} is used, or %8\textsuperscript{th} March, 2000 if the package option -% \texttt{nodayofweek} is used.\\ -% \DescribeMacro{\shortdate} -% The declaration \verb"\shortdate" will redefine -%\verb"\today" to produce the current date displayed in the form -%Wed 8\textsuperscript{th} Mar, 2000 if the package option -%\texttt{dayofweek} is used, or 8\textsuperscript{th} Mar, 2000 -%if the package option \texttt{nodayofweek} is used.\\ -% \DescribeMacro{\ddmmyyyydate} -% The declaration \verb"\ddmmyyyydate" will redefine -%\verb"\today" to produce -% the current date displayed in the form 08/03/2000\\ -% \DescribeMacro{\dmyyyydate} -% The declaration \verb"\dmyyyydate" will redefine -%\verb"\today" to produce -% the current date displayed in the form 8/3/2000\\ -% \DescribeMacro{\ddmmyydate} -% The declaration \verb"\ddmmyydate" will redefine -%\verb"\today" to produce -% the current date displayed in the form 08/03/00\\ -% \DescribeMacro{\dmyydate} -% The declaration \verb"\dmyydate" will redefine -%\verb"\today" to produce -% the current date displayed in the form 8/3/00\\ -% \DescribeMacro{\textdate} -% The declaration \verb"\textdate" will redefine -%\verb"\today" to produce the current date displayed in the form: -%Wednesday the Eighth of March, Two Thousand if the package option -%\texttt{dayofweek} is used, or Eighth of March, Two Thousand if -%the package option \texttt{nodayofweek} is used. Note that -%\verb"\textdate" is defined for use with English, it won't -%look right if it is used when another language has been +%\pkgopt{nodayofweek} is used. +% +%\begin{definition}[\DescribeMacro{\shortdate}] +%\cs{shortdate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form Wed 8\textsuperscript{th} Mar, 2000 if +%the package option \pkgopt{dayofweek} is used, or +%8\textsuperscript{th} Mar, 2000 if the package option +%\pkgopt{nodayofweek} is used. +% +%\begin{definition}[\DescribeMacro{\ddmmyyyydate}] +%\cs{ddmmyyyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 08/03/2000. +% +%\begin{definition}[\DescribeMacro{\dmyyyydate}] +%\cs{dmyyyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 8/3/2000. +% +%\begin{definition}[\DescribeMacro{\ddmmyydate}] +%\cs{ddmmyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 08/03/00. +% +%\begin{definition}[\DescribeMacro{\dmyydate}] +%\cs{dmyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 8/3/00. +% +%\begin{definition}[\DescribeMacro{\textdate}] +%\cs{textdate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form: Wednesday the Eighth of March, Two +%Thousand if the package option \pkgopt{dayofweek} is used, or Eighth +%of March, Two Thousand if the package option \pkgopt{nodayofweek} is +%used. Note that \cs{textdate} is defined for use with English, it +%won't look right if it is used when another language has been %selected\footnote{in fact, you may get an error from the -%\sty{fmtcount} package if you are using a language that it -%doesn't support.}. If you want to define a similar command for -%another language, you will first need to check that the -%\sty{fmtcount} package supports that language. +%\sty{fmtcount} package if you are using a language that it doesn't +%support.}. If you want to define a similar command for another +%language, you will first need to check that the \sty{fmtcount} +%package supports that language. % -% \vspace{10pt}\noindent \meta{Month} \meta{Day} \meta{Year} formats:\\ -% \DescribeMacro{\usdate} -% The declaration \verb"\usdate" will redefine -%\verb"\today" to produce the current date displayed in the form -%March 8, 2000. (As \TeX\ and \LaTeX\ do by default.)\\ -% \DescribeMacro{\mmddyyyydate} -% The declaration \verb"\mmddyyyydate" will redefine -%\verb"\today" to produce the current date displayed in the form -%03/08/2000\\ -% \DescribeMacro{\mdyyyydate} -% The declaration \verb"\mdyyyydate" will redefine -%\verb"\today" to produce the current date displayed in the form -%3/8/2000\\ -% \DescribeMacro{\mmddyydate} -% The declaration \verb"\mmddyydate" will redefine -%\verb"\today" to produce the current date displayed in the form -%03/08/00\\ -% \DescribeMacro{\mdyydate} -% The declaration \verb"\mdyydate" will redefine -%\verb"\today" to produce the current date displayed in the form -%3/8/00 +%\subsection{\texorpdfstring{\meta{Month} \meta{Day} \meta{Year}}{Month Day Year} formats} % -%\vspace{10pt}\noindent In addition, the declarations \verb"\date"\meta{lang} are -%available for all languages defined either by -%calling \sty{babel} prior to \sty{datetime} or by -%passing the language name as an option to \sty{datetime}. -%See~\autoref{sec:newdate} if you want to define your own customised date format. +%\begin{definition}[\DescribeMacro{\usdate}] +%\cs{usdate} +%\end{definition} +%This declaration will redefine \cs{today} to produce the current +%date displayed in the form March 8, 2000. (As \TeX\ and \LaTeX\ do +%by default.) % -%As from version 2.43, the numerical date formats (such as -%\verb"\ddmmyyyydate") use the command -%\verb"\dateseparator" to separate the numbers. So, for example, -%if you want to hyphens instead of slashes, you can do: -%\begin{verbatim} -%\renewcommand{\dateseparator}{-} -%\end{verbatim} +%\begin{definition}[\DescribeMacro{\mmddyyyydate}] +%\cs{mmddyyyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 03/08/2000. +% +%\begin{definition}[\DescribeMacro{\mdyyyydate}] +%\cs{mdyyyydate} +%\end{definition} +%This declaration will redefine \verb"\today" to produce the current +%date displayed in the form 3/8/2000. +% +%\begin{definition}[\DescribeMacro{\mmddyydate}] +%\cs{mmddyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 03/08/00. +% +%\begin{definition}[\DescribeMacro{\mdyydate}] +%\cs{mdyydate} +%\end{definition} +%This declaration will redefine \ics{today} to produce the current +%date displayed in the form 3/8/00. +% +%\subsection{Dates defined by \texorpdfstring{\styfmt{babel}}{babel}} +% +%In addition to the above, the declarations \cs{date}\meta{lang} are +%available for all languages defined either by calling \sty{babel} +%prior to \styfmt{datetime} or by passing the language name as an +%option to \styfmt{datetime}. See~\sectionref{sec:newdate} if you +%want to define your own customised date format. % % \section{Time Commands} -%\DescribeMacro{\currenttime} -% The current time is displayed using the command -%\verb"\currenttime". % -%\DescribeMacro{\formattime}A specific time can be displayed using -%the command \cs{formattime}\marg{hour}\marg{minute}\marg{second}, where -%\meta{hour} is a number from~0 to~23, and \meta{minute} and +%The current time is displayed using the command +%\begin{definition}[\DescribeMacro{\currenttime}] +%\cs{currenttime} +%\end{definition} +% +%A specific time can be displayed using the command +%\begin{definition}[\DescribeMacro{\formattime}] +%\cs{formattime}\marg{hour}\marg{minute}\marg{second} +%\end{definition} +%where \meta{hour} is a number from~0 to~23, and \meta{minute} and %\meta{second} are numbers from~0 to~59. % -%\DescribeMacro{\settimeformat} -% The format can be changed using the declaration -%\cs{settimeformat}\marg{style}, where \meta{style} is the name of the +%The format can be changed using the declaration +%\begin{definition}[\DescribeMacro{\settimeformat}] +%\cs{settimeformat}\marg{style} +%\end{definition} +%where \meta{style} is the name of the %format. Predefined formats are: %\begin{description} %\item[xxivtime] Twenty-four hour time in the form 22:28 (Default) @@ -216,19 +258,20 @@ %Twenty-Eight minutes past Ten in the afternoon. %\end{description} % -% \DescribeMacro{\newtimeformat} -% New time formats can be defined using the command:\\[5pt] -%\cs{newtimeformat}\marg{name}\marg{format}\\[5pt] -% where \meta{name} is the name of the new format (used in -%\cs{settimeformat}), and \meta{format} is how to format the -%time. Within \meta{format} you can use the counters -%\texttt{HOUR} (number of hours after midnight), \texttt{MINUTE} -%(number of minutes past the hour), \texttt{SECOND} (number of -%seconds) \texttt{HOURXII} (number of -%hours after midnight/midday), \texttt{TOHOUR} (the next hour) and -%\texttt{TOMINUTE} (number of minutes to the next hour), and the -%corresponding commands: \cs{THEHOUR}, \cs{THEMINUTE}, \cs{THESECOND}, -%\cs{THEHOURXII}, \cs{THETOHOUR} and \cs{THETOMINUTE}. +%New time formats can be defined using the command: +%\begin{definition}[\DescribeMacro{\newtimeformat}] +%\cs{newtimeformat}\marg{name}\marg{format} +%\end{definition} +%where \meta{name} is the name of the new format (used in +%\ics{settimeformat}), and \meta{format} is how to format the time. +%Within \meta{format} you can use the counters \ctr{HOUR} (number +%of hours after midnight), \ctr{MINUTE} (number of minutes past +%the hour), \ctr{SECOND} (number of seconds) \ctr{HOURXII} +%(number of hours after midnight/midday), \ctr{TOHOUR} (the next +%hour) and \ctr{TOMINUTE} (number of minutes to the next hour), +%and the corresponding commands: \ics{THEHOUR}, \ics{THEMINUTE}, +%\ics{THESECOND}, \ics{THEHOURXII}, \ics{THETOHOUR} and +%\ics{THETOMINUTE}. % %For example, to define a new time format that uses a dot instead of a %colon: @@ -242,7 +285,10 @@ %\end{verbatim} % %As from version 2.43, if you only want to change the separator, -%you can simply redefine \cs{timeseparator} +%you can simply redefine +%\begin{definition}[\DescribeMacro{\timeseparator}] +%\cs{timeseparator} +%\end{definition} %instead of defining a new time format. For example: %\begin{verbatim} %\renewcommand{\timeseparator}{.} @@ -251,8 +297,10 @@ %format defined above. % % \section{Formating Dates} -% \DescribeMacro{\pdfdate} -% The command \verb"\pdfdate"\footnote{thanks to Ulrich Dirr for +%\begin{definition}[\DescribeMacro{\pdfdate}] +%\cs{pdfdate} +%\end{definition} +% This command\footnote{thanks to Ulrich Dirr for %asking about this} prints the date in the format required for % PDF files, e.g.\ if the date is 1 May 2004 and time is % 22:02, \verb"\pdfdate" will print 20040501220200. The reason @@ -276,15 +324,18 @@ % % There are two commands that print the name of the current % month: -% \DescribeMacro{\monthname} -% \verb"\monthname" prints the current month name in full, +%\begin{definition}[\DescribeMacro{\monthname}] +%\cs{monthname}\oarg{num} +%\end{definition} +%prints the current month name in full, %e.g.\ August, and -% \DescribeMacro{\shortmonthname} -% \verb"\shortmonthname" prints the abbreviated month name, -%e.g.\ Aug. Both \verb"\monthname" and -%\verb"\shortmonthname" take an optional argument (a number from -%1 to 12) if the name of a specific month is required. For -%example, \verb"\monthname[6]" will produced the output: June. +%\begin{definition}[\DescribeMacro{\shortmonthname}] +%\cs{shortmonthname}\oarg{num} +%\end{definition} +%prints the abbreviated month name, e.g.\ Aug. Both \cs{monthname} +%and \cs{shortmonthname} take an optional argument (a number from 1 +%to 12) if the name of a specific month is required. For example, +%\verb"\monthname[6]" will produced the output: June. % % The day of the week is computed using the algorithm documented at % \url{http://userpages.wittenburg.edu/bshelburne/Comp150/DayOfWeek.htm}. @@ -292,100 +343,104 @@ %Jan, 1901 and 31\textsuperscript{st} Dec, 2099. % The following macros display the day of week for a given date: % -% \noindent\DescribeMacro{\dayofweekname} -%\cs{dayofweekname}\marg{day}\marg{month}\marg{year} prints the -% day of week for the specified date. For example, -%\verb"\dayofweekname{31}{10}{2002}" -% will produce the output: Thursday.\\ -% \DescribeMacro{\shortdayofweekname} -%\cs{shortdayofweekname}\meta{day}\marg{month}\marg{year} prints the -%abbreviated name for the -% day of week for the specified date. For example\\ -% \verb"\shortdayofweekname{31}{10}{2002}"\\ -% will produce the output: Thu. +%\begin{definition}[\DescribeMacro{\dayofweekname}] +%\cs{dayofweekname}\marg{day}\marg{month}\marg{year} +%\end{definition} +%prints the day of week for the specified date. For example, +%\begin{verbatim} +%\dayofweekname{31}{10}{2002} +%\end{verbatim} +%will produce the output: Thursday. % -% \noindent\DescribeMacro{\ifshowdow} -% The \TeX\ conditional \verb"\ifshowdow" can be used to determine -% whether or not the option \texttt{dayofweek} has been passed to -%the package. -% For example: +%\begin{definition}[\DescribeMacro{\shortdayofweekname}] +%\cs{shortdayofweekname}\meta{day}\marg{month}\marg{year} +%\end{definition} +%prints the abbreviated name for the day of week for the specified +%date. For example +%\begin{verbatim} +%\shortdayofweekname{31}{10}{2002} +%\end{verbatim} +%will produce the output: Thu. +% +%\begin{definition}[\DescribeMacro{\ifshowdow}] +%\cs{ifshowdow} +%\end{definition} +%This \TeX\ conditional can be used to determine whether or not the +%option \pkgopt{dayofweek} has been passed to the package. For +%example: %\begin{verbatim} %\ifshowdow\dayofweekname{31}{10}{2002} \fi %\end{verbatim} -% will only display the day of week if the \texttt{dayofweek} -%option was passed to \sty{datetime}. -% Alternatively, you can use David~Carlisle's \sty{ifthen} -%package: +%will only display the day of week if the \pkgopt{dayofweek} option +%was passed to \styfmt{datetime}. Alternatively, you can use +%David~Carlisle's \sty{ifthen} package: %\begin{verbatim} %\ifthenelse{\boolean{showdow}}{\dayofweekname{31}{10}{2002} }{} %\end{verbatim} % -%\noindent\DescribeMacro{\ordinaldate} -%The command \cs{ordinaldate}\marg{number} -%displays \meta{number} as a date-type ordinal. If the -%current language is English, this will simply pass -%the argument to \cs{ordinalnum} (defined in the -%\sty{fmtcount} package), -%if the current language is Breton, Welsh or French, a superscript -%will only be added if \meta{number} is 1, otherwise only -%\meta{number} will be displayed. +%The command +%\begin{definition}[\DescribeMacro{\ordinaldate}] +%\cs{ordinaldate}\marg{number} +%\end{definition} +%displays \meta{number} as a date-type ordinal. If the current +%language is English, this will simply pass the argument to +%\ics{ordinalnum} (defined in the \sty{fmtcount} package), if the +%current language is Breton, Welsh or French, a superscript will only +%be added if \meta{number} is 1, otherwise only \meta{number} will be +%displayed. % -% \DescribeMacro{\formatdate} -%The macro -%\cs{formatdate}\marg{day}\marg{month}\marg{year}\footnote{Note the -%name change since version 1.1. The command name was changed from -%\cs{thedate} to \cs{formatdate} to avoid a name clash when using the -%\sty{seminar} class file.} formats the specified date according to -%the current format of \cs{today}\footnote{To be more precise, -%\cs{today} is defined to be -%\cs{formatdate\{\cs{day}\}\{\cs{month}\}\{\cs{year}\}} where -%\cs{longdate} etc change the definition of \cs{formatdate}}. +%The macro\footnote{Note the name change since version 1.1. The +%command name was changed from \cs{thedate} to \cs{formatdate} to +%avoid a name clash when using the \sty{seminar} class file.} +%\begin{definition}[\DescribeMacro{\formatdate}] +%\cs{formatdate}\marg{day}\marg{month}\marg{year} +%\end{definition} +%formats the specified date according to the current format of +%\ics{today}\footnote{To be more precise, \ics{today} is defined to +%be \ics{formatdate}\{\cs{day}\}\{\cs{month}\}\{\cs{year}\} where +%\ics{longdate} etc change the definition of \cs{formatdate}}. %(Arguments must all be integers.) For example, in combination with -%\verb"\longdate", the command +%\ics{longdate}, the command %\begin{verbatim} %\formatdate{27}{9}{2004} %\end{verbatim} %will produce the output: Monday 27\textsuperscript{th} September, %2004. % -% \DescribeMacro{\twodigit} -% You can ensure that a number is displayed with at least two -%digits by using the command -%\cs{twodigit}\marg{num}. -% This is of use if you want to define your own date or time -%formats. +%You can ensure that a number is displayed with at least two digits +%using the command +%\begin{definition}[\DescribeMacro{\twodigit}] +%\cs{twodigit}\marg{num} +%\end{definition} % -% \section{Defining New Date Formats}\label{sec:newdate} +%\section{Defining New Date Formats}\label{sec:newdate} % -% \DescribeMacro{\newdateformat} -% New date formats can be defined using the command:\\[5pt] -% \cs{newdateformat}\marg{name}\marg{format}\\[5pt] -% where \meta{name} is the name of the new format, and -% \meta{format} is how to format the date. Within the -% argument \meta{format} you can use the commands \cs{THEDAY}, -%\cs{THEMONTH} -% and \cs{THEYEAR} to represent the relevant day, month and -%year, or you can use the counters -% \texttt{DAY}, \texttt{MONTH} and \texttt{YEAR} if you want to -%use \cs{ordinal} etc. Once you have defined the -% new date format, you can then switch to it using the declaration -%\verb'\'\meta{name} -% (i.e.\ the name you specified preceded by a backslash), and -% subsequent calls to \cs{today} and \cs{formatdate} will -%use your new format. +%New date formats can be defined using the command: +%\begin{definition}[\DescribeMacro{\newdateformat}] +% \cs{newdateformat}\marg{name}\marg{format} +%\end{definition} +%where \meta{name} is the name of the new format, and \meta{format} +%is how to format the date. Within the argument \meta{format} you can +%use the commands \ics{THEDAY}, \ics{THEMONTH} and \ics{THEYEAR} to +%represent the relevant day, month and year, or you can use the +%counters \ctr{DAY}, \ctr{MONTH} and \ctr{YEAR} if you want to use +%\ics{ordinal} etc. Once you have defined the new date format, you +%can then switch to it using the declaration \verb'\'\meta{name} +%(i.e.\ the name you specified preceded by a backslash), and +%subsequent calls to \ics{today} and \ics{formatdate} will use your +%new format. % -% For example, suppose you want to define a new date format called, -% say, \texttt{mydate}, that will typeset the date in the form: -%8-3-2002, -% then you can do: +%For example, suppose you want to define a new date format called, +%say, \texttt{mydate}, that will typeset the date in the form: +%8-3-2002, then you can do: %\begin{verbatim} %\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} %\end{verbatim} -%\cs{newdateformat} will then define the declaration +%\ics{newdateformat} will then define the declaration %\cs{mydate} which can be used to -% switch to your new format. In the following example, -% two new date formats are defined, and they are then -% selected to produce two different formats for the current date: +%switch to your new format. In the following example, +%two new date formats are defined, and they are then +%selected to produce two different formats for the current date: %\begin{verbatim} %\newdateformat{dashdate}{% %\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} @@ -396,13 +451,12 @@ %Dash: \dashdate\today. %US: \usvardate\today. %\end{verbatim} -%If the current date is, say, 8th March, 2002, the above code will -% produce the following: -%Dash: 08-03-2002. -%US: March 8\textsuperscript{th}, 2002. +%If the current date is, say, 8th March, 2002, the above code will +%produce the following: Dash: 08-03-2002. US: March +%8\textsuperscript{th}, 2002. % -%Note that \cs{THEDAY} etc and \texttt{DAY} etc have no real -%meaning outside \cs{newdateformat} (this is why they +%Note that \ics{THEDAY} etc and \ctr{DAY} etc have no real +%meaning outside \ics{newdateformat} (this is why they %are in uppercase). Incidentally, the \texttt{dashdate} format %is not really necessary, as you can achieve this format %using: @@ -411,9 +465,9 @@ %\ddmmyyyydate %\end{verbatim} % -%Another note: in the above code, \cs{ordinal} was -%used to illustrate the use of the \texttt{DAY} counter. It -%is better to use \cs{ordinaldate} instead: +%Another note: in the above code, \ics{ordinal} was +%used to illustrate the use of the \ctr{DAY} counter. It +%is better to use \ics{ordinaldate} instead: %\begin{verbatim} %\newdateformat{usvardate}{% %\monthname[\THEMONTH] \ordinaldate{\THEDAY}, \THEYEAR} @@ -422,107 +476,113 @@ %\section{Saving Dates} % %It is possible to save a date for later use using the command: -%\footnote{Thanks to Denis Bitouz\'e for asking about this}\par -%\DescribeMacro{\newdate} +%\footnote{Thanks to Denis Bitouz\'e for asking about this} +%\begin{definition}[\DescribeMacro{\newdate}] %\cs{newdate}\marg{name}\marg{day}\marg{month}\marg{year} +%\end{definition} % %This date can later be displayed using the same format as that -%used by \cs{formatdate} using the command:\par -%\DescribeMacro{\displaydate} +%used by \ics{formatdate} using the command: +%\begin{definition}[\DescribeMacro{\displaydate}] %\cs{displaydate}\marg{name} +%\end{definition} % %Individual elements of the date can be extracted using the -%commands:\par -%\DescribeMacro{\getdateday} -%\cs{getdateday}\marg{name}\par -%\DescribeMacro{\getdatemonth} -%\cs{getdatemonth}\marg{name}\par -%\DescribeMacro{\getdateyear} +%commands: +%\begin{definition}[\DescribeMacro{\getdateday}] +%\cs{getdateday}\marg{name} +%\end{definition} +%\begin{definition}[\DescribeMacro{\getdatemonth}] +%\cs{getdatemonth}\marg{name} +%\end{definition} +%\begin{definition}[\DescribeMacro{\getdateyear}] %\cs{getdateyear}\marg{name} +%\end{definition} % %\section{Predefined Names} % -%The following commands are defined by the \sty{datetime} +%The following commands are defined by the \styfmt{datetime} %package: % %\begin{tabular}{ll} %\bfseries Command Name & \bfseries Default Value\\ -%\cs{dateseparator} & \verb'/'\\ -%\cs{timeseparator} & \verb':'\\ -%\cs{amname} & \texttt{am}\\ -%\cs{pmname} & \texttt{pm}\\ -%\cs{amorpmname} & \cs{amname} if morning, otherwise \cs{pmname}\\ -%\cs{amstring} & \texttt{in the morning}\\ -%\cs{pmstring} & \texttt{in the afternoon}\\ -%\cs{amorpmstring} & \cs{amstring} if morning, otherwise -%\cs{pmstring}\\ -%\cs{halfpast} & \texttt{Half past}\\ -%\cs{quarterpast} & \texttt{Quarter past}\\ -%\cs{quarterto} & \texttt{Quarter to}\\ -%\cs{noon} & \texttt{Noon}\\ -%\cs{midnight} & \texttt{Midnight}\\ -%\cs{oclockstring} & \texttt{O'Clock} +%\ics{dateseparator} & \verb'/'\\ +%\ics{timeseparator} & \verb':'\\ +%\ics{amname} & \texttt{am}\\ +%\ics{pmname} & \texttt{pm}\\ +%\ics{amorpmname} & \ics{amname} if morning, otherwise \ics{pmname}\\ +%\ics{amstring} & \texttt{in the morning}\\ +%\ics{pmstring} & \texttt{in the afternoon}\\ +%\ics{amorpmstring} & \ics{amstring} if morning, otherwise +%\ics{pmstring}\\ +%\ics{halfpast} & \texttt{Half past}\\ +%\ics{quarterpast} & \texttt{Quarter past}\\ +%\ics{quarterto} & \texttt{Quarter to}\\ +%\ics{noon} & \texttt{Noon}\\ +%\ics{midnight} & \texttt{Midnight}\\ +%\ics{oclockstring} & \texttt{O'Clock} %\end{tabular} % -% \section{Package Options} +%\section{Package Options} % -% The following options may be passed to this package:\\[10pt] -% \begin{tabular}{@{\ttfamily}ll} -% long & make \cs{today} produce long date\\ -% short & make \cs{today} produce short date\\ -% yyyymmdd & make \cs{today} produce YYYY/MM/DD date\\ -% ddmmyyyy & make \cs{today} produce DD/MM/YYYY date\\ -% dmyyyy & make \cs{today} produce D/M/YYYY date\\ -% ddmmyy & make \cs{today} produce DD/MM/YY date\\ -% dmyy & make \cs{today} produce D/M/YY date\\ -% text & make \cs{today} produce text date\\ -% us & make \cs{today} produce US style date\\ -% mmddyyyy & make \cs{today} produce MM/DD/YYYY date\\ -% mdyyyy & make \cs{today} produce M/D/YYYY date\\ -% mmddyy & make \cs{today} produce MM/DD/YY date\\ -% mdyy & make \cs{today} produce M/D/YY date\\ -% raise & make ordinal st,nd,rd,th appear as superscript\\ -% level & make ordinal st,nd,rd,th appear level with rest of -%text\\ -% dayofweek & make the day of week appear for \cs{longdate}, -%\cs{shortdate} \\ -% & or \cs{textdate}\\ -% nodayofweek & don't display the day of week.\\ -% hhmmss & make \cs{currenttime} produce \texttt{hhmmsstime} -%format\\ -% 24hr & make \cs{currenttime} produce \texttt{xxivtime} -%format\\ -% 12hr & make \cs{currenttime} produce \texttt{ampmtime} -%format\\ -% oclock & make \cs{currenttime} produce \texttt{oclock} -%format\\ -% nodate & Don't redefine \cs{today} or define the month or -%day of week commands\\ -% & (useful if you only want the time commands) \\ -% iso & as ddmmyyyy and hhmmss but also sets date separator to -\\ -%& and time separator to : -% \end{tabular} +% The following options may be passed to this package: +%\begin{description} +%\item[\pkgopt{long}] make \cs{today} produce long date +%\item[\pkgopt{short}] make \cs{today} produce short date +%\item[\pkgopt{yyyymmdd}] make \cs{today} produce YYYY/MM/DD date +%\item[\pkgopt{ddmmyyyy}] make \cs{today} produce DD/MM/YYYY date +%\item[\pkgopt{dmyyyy}] make \cs{today} produce D/M/YYYY date +%\item[\pkgopt{ddmmyy}] make \cs{today} produce DD/MM/YY date +%\item[\pkgopt{dmyy}] make \cs{today} produce D/M/YY date +%\item[\pkgopt{text}] make \cs{today} produce text date +%\item[\pkgopt{us}] make \cs{today} produce US style date +%\item[\pkgopt{mmddyyyy}] make \cs{today} produce MM/DD/YYYY date +%\item[\pkgopt{mdyyyy}] make \cs{today} produce M/D/YYYY date +%\item[\pkgopt{mmddyy}] make \cs{today} produce MM/DD/YY date +%\item[\pkgopt{mdyy}] make \cs{today} produce M/D/YY date +%\item[\pkgopt{raise}] make ordinal st,nd,rd,th appear as superscript +%\item[\pkgopt{level}] make ordinal st,nd,rd,th appear level with rest of +%text +%\item[\pkgopt{dayofweek}] make the day of week appear for \ics{longdate}, +%\ics{shortdate} +% or \ics{textdate} +%\item[\pkgopt{nodayofweek}] don't display the day of week. +%\item[\pkgopt{hhmmss}] make \cs{currenttime} produce \texttt{hhmmsstime} +%format +%\item[\pkgopt{24hr}] make \cs{currenttime} produce \texttt{xxivtime} +%format +%\item[\pkgopt{12hr}] make \cs{currenttime} produce \texttt{ampmtime} +%format +%\item[\pkgopt{oclock}] make \cs{currenttime} produce \texttt{oclock} +%format +%\item[\pkgopt{nodate}] Don't redefine \cs{today} or define the month or +%day of week commands +% (useful if you only want the time commands) +%\item[\pkgopt{iso}] as \pkgopt{ddmmyyyy} and \pkgopt{hhmmss} but +%also sets date separator to \texttt{-} +% and time separator to \texttt{:} +% \end{description} % -%The default options are: \texttt{long}, \texttt{raise}, -%\texttt{dayofweek} and \texttt{24hr}. +%The default options are: \pkgopt{long}, \pkgopt{raise}, +%\pkgopt{dayofweek} and \pkgopt{24hr}. % %\section{Multilingual Support} % -%If you use the \sty{ngerman} package, you must use \sty{datetime}'s -%\texttt{ngerman} package option if you want the date displayed +%If you use the \sty{ngerman} package, you must use \styfmt{datetime}'s +%\pkgopt{ngerman} package option if you want the date displayed %in the same form as \sty{ngerman}. You must also load \sty{ngerman} -%\emph{before} you load \sty{datetime}. Similarly for the +%\emph{before} you load \styfmt{datetime}. Similarly for the %\sty{german} package. % %If you want to use the \sty{babel} package, you must load -%it \emph{before} you load the \sty{datetime} package. This +%it \emph{before} you load the \styfmt{datetime} package. This %is because the \sty{babel} \cs{date}\meta{lang} commands -%redefine \cs{today}, whereas the \sty{datetime} package -%redefines \cs{today} to use \cs{formatdate}, and the -%date formatting commands (such as \cs{longdate}) redefine +%redefine \ics{today}, whereas the \sty{datetime} package +%redefines \cs{today} to use \ics{formatdate}, and the +%date formatting commands (such as \ics{longdate}) redefine %\cs{formatdate} rather than \cs{today}. This ensures %consistent formatting of the dates whether you use \cs{today} or -%\cs{formatdate}. Therefore, the \sty{datetime} package +%\cs{formatdate}. Therefore, the \styfmt{datetime} package %has to redefine all the \cs{date}\meta{lang} commands accordingly. %Thus the multilingual date support is mostly limited to that provided %by \sty{babel}. Additional support, such as the day of @@ -530,7 +590,7 @@ %languages that I know, or that other people have been able to supply %for me. % -%As from v2.56, the package options supplied to \sty{datetime} +%As from v2.56, the package options supplied to \styfmt{datetime} %override \sty{babel}'s date format. For example: %\begin{verbatim} %\usepackage[french,spanish]{babel} @@ -545,29 +605,31 @@ %\ddmmyyyydate %\end{verbatim} %the date format will be switched back to \cs{datefrench} or -%\cs{datespanish} whenever the language is set. You can use\par -%\noindent\DescribeMacro{\setdefaultdate}\cs{setdefaultdate}\marg{declaration}\par -%\noindent to always use \marg{declaration} whenever the language +%\cs{datespanish} whenever the language is set. You can use +%\begin{definition}[\DescribeMacro{\setdefaultdate}] +%\cs{setdefaultdate}\marg{declaration} +%\end{definition} +%to always use \marg{declaration} whenever the language %is set. For example: %\begin{verbatim} %\setdefaultdate{\ddmmyyyydate} %\end{verbatim} % -%The commands \cs{monthname} and \cs{shortmonthname}, +%The commands \ics{monthname} and \ics{shortmonthname}, %will produce the month name in the current language. %If you want the month name in a specific language, you %can use the command \cs{monthname}\meta{lang}. %For example, \verb"\monthnamefrench[6]" will produce the output: -%juin. Note that \cs{textdate} is formatted for English dates, +%juin. Note that \ics{textdate} is formatted for English dates, %and won't look right if used with another language setting. If you %want a textual date, the \sty{fmtcount} package (which is -%loaded by \sty{datetime}) defines some commands which display +%loaded by \styfmt{datetime}) defines some commands which display %a number or ordinal as a word, but it only has very limited %multilingual support. See the \sty{fmtcount} documentation %for further details. % %There is currently only \emph{limited} multilingual support for -%\cs{dayofweekname} and \cs{shortdayofweekname} (just +%\ics{dayofweekname} and \ics{shortdayofweekname} (just %English, French, Portuguese, Spanish and German\footnote{thanks %to Uwe Bieling for supplying the German names}). You can add support %for other languages by defining the commands @@ -578,7 +640,7 @@ % %You can use the following as templates. Replace %\texttt{english} with the name of your language (as given -%by \cs{languagename}) and replace \texttt{Sunday} +%by \ics{languagename}) and replace \texttt{Sunday} %etc as appropriate: %\begin{verbatim} %\providecommand*{\dayofweeknameidenglish}[1]{% @@ -608,15 +670,15 @@ % %\section{Registers} % -%\TeX\ provides \cs{day}, \cs{month}, \cs{year} registers. In -%addition, \sty{datetime} provides the registers: -%\cs{currenthour}, \cs{currentminute} and \cs{currentsecond}. +%\TeX\ provides \ics{day}, \ics{month} and \ics{year} registers. In +%addition, \styfmt{datetime} provides the registers: +%\ics{currenthour}, \ics{currentminute} and \ics{currentsecond}. %Note that old distributions of \TeX\ will always have %\cs{currentsecond} set to zero. % %\section{Configuration File} % -%As from Version 2.4, the \sty{datetime} package will read in settings +%As from Version 2.4, the \styfmt{datetime} package will read in settings %from the configuration file \texttt{datetime.cfg}, if it exists, %which will override the default package options. For example, %suppose you prefer a short date without the day of week by default, @@ -630,8 +692,8 @@ %\begin{verbatim} %\usepackage{datetime} %\end{verbatim} -%without having to specify the \texttt{short} and -%\texttt{nodayofweek} options. +%without having to specify the \pkgopt{short} and +%\pkgopt{nodayofweek} options. % %You can also use this file to define and set your own date %styles. For example, you could create @@ -640,14 +702,14 @@ %\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} %\dashdate %\end{verbatim} -%Whenever you use the \sty{datetime} package, it will now +%Whenever you use the \styfmt{datetime} package, it will now %use this format by default. % %\section{LaTeX2HTML styles} % %\changes{2.43}{2005/02/25}{Added LaTeX2HTML support}% %\changes{2.44}{2005/03/03}{Fixed minor bugs in Perl scripts} -%Version 2.43 and above of the \sty{datetime} bundle +%Version 2.43 and above of the \styfmt{datetime} bundle %supplies the LaTeX2HTML style file \texttt{datetime.perl}. %This file should be placed in a %directory searched by LaTeX2HTML. The following limitations @@ -655,9 +717,7 @@ % %\begin{itemize} %\item The configuration file \texttt{datetime.cfg} -%is currently ignored. (This is because -%I can't work out the correct code to do this. If you -%know how to do this, please let me know.) You can however +%is currently ignored. You can however %do: %\begin{verbatim} %\usepackage{datetime} @@ -670,7 +730,7 @@ % %\item Some of the languages are not implemented. % -%\item The package option \texttt{nodate} is not implemented. +%\item The package option \pkgopt{nodate} is not implemented. % %\end{itemize} % @@ -679,9 +739,12 @@ %There is a \sty{datetime} FAQ available at: %\url{http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/} % +%\StopEventually{\phantomsection +%\addcontentsline{toc}{section}{Index}\PrintIndex +%} +% % % -%\StopEventually{} %\section{The Code} %\iffalse % \begin{macrocode} @@ -692,7 +755,7 @@ % This section documents the code for \texttt{datetime.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime}[2010/02/06 v2.57 Date Time Package] +\ProvidesPackage{datetime}[2010/09/21 v2.58 Date Time Package] % \end{macrocode} %\texttt{fmtcount.sty} needs to be loaded here as it defines the % command \cs{fmtord} which may be redefined later: @@ -1499,55 +1562,80 @@ settings}} \renewcommand*{\timeseparator}{:}% } % \end{macrocode} +% +%\begin{macro}{\loadDTdef} +%\changes{2.58}{2010/09/21}{new} +% Load the datetime language definition file for the given language +% \begin{macrocode} +\newcommand*{\loadDTdef}[1]{% +% \end{macrocode} +% Check whether the file has already been loaded. +% \begin{macrocode} + \@ifundefined{ver@dt-#1.def}% + {% + \InputIfFileExists{dt-#1.def}% + {}% + {% + \PackageWarning{datetime}{Can't find datetime language + definition file for `#1'}% + }% + }% +% \end{macrocode} +% File already loaded, so do nothing. +% \begin{macrocode} + {}% +} +% \end{macrocode} +%\end{macro} % Multilingual support. These package options shouldn't really be % needed if babel has already been loaded. % \begin{macrocode} -\DeclareOption{austrian}{\input{dt-austrian.def}} -\DeclareOption{american}{\input{dt-american.def}} -\DeclareOption{bahasa}{\input{dt-bahasa.def}} -\DeclareOption{basque}{\input{dt-basque.def}} -\DeclareOption{breton}{\input{dt-breton.def}} -\DeclareOption{british}{\input{dt-british.def}} -\DeclareOption{bulgarian}{\input{dt-bulgarian.def}} -\DeclareOption{catalan}{\input{dt-catalan.def}} -\DeclareOption{croatian}{\input{dt-croatian.def}} -\DeclareOption{czech}{\input{dt-czech.def}} -\DeclareOption{danish}{\input{dt-danish.def}} -\DeclareOption{dutch}{\input{dt-dutch.def}} -\DeclareOption{esperanto}{\input{dt-esperanto.def}} -\DeclareOption{estonian}{\input{dt-estonian.def}} -\DeclareOption{finnish}{\input{dt-finnish.def}} -\DeclareOption{french}{\input{dt-french.def}} -\DeclareOption{galician}{\input{dt-galician.def}} -\DeclareOption{german}{\input{dt-german.def}\dategerman} -\DeclareOption{greek}{\input{dt-greek.def}} -\DeclareOption{hebrew}{\input{dt-hebrew.def}} -\DeclareOption{icelandic}{\input{dt-icelandic.def}} -\DeclareOption{irish}{\input{dt-irish.def}} -\DeclareOption{italian}{\input{dt-italian.def}} -\DeclareOption{latin}{\input{dt-latin.def}} -\DeclareOption{lsorbian}{\input{dt-lsorbian.def}} -\DeclareOption{magyar}{\input{dt-magyar.def}} -\DeclareOption{naustrian}{\input{dt-naustrian.def}} -\DeclareOption{ngerman}{\input{dt-ngerman.def}\datengerman} -\DeclareOption{norsk}{\input{dt-norsk.def}} -\DeclareOption{polish}{\input{dt-polish.def}} -\DeclareOption{portuges}{\input{dt-portuges.def}} -\DeclareOption{romanian}{\input{dt-romanian.def}} -\DeclareOption{russian}{\input{dt-russian.def}} -\DeclareOption{samin}{\input{dt-samin.def}} -\DeclareOption{scottish}{\input{dt-scottish.def}} -\DeclareOption{serbian}{\input{dt-serbian.def}} -\DeclareOption{slovak}{\input{dt-slovak.def}} -\DeclareOption{slovene}{\input{dt-slovene.def}} -\DeclareOption{spanish}{\input{dt-spanish.def}} -\DeclareOption{swedish}{\input{dt-swedish.def}} -\DeclareOption{turkish}{\input{dt-turkish.def}} -\DeclareOption{ukraineb}{\input{dt-ukraineb.def}} -\DeclareOption{usorbian}{\input{dt-usorbian.def}} -\DeclareOption{UKenglish}{\input{dt-UKenglish.def}} -\DeclareOption{USenglish}{\input{dt-USenglish.def}} -\DeclareOption{welsh}{\input{dt-welsh.def}} +\DeclareOption{austrian}{\loadDTdef{austrian}} +\DeclareOption{american}{\loadDTdef{american}} +\DeclareOption{bahasa}{\loadDTdef{bahasa}} +\DeclareOption{basque}{\loadDTdef{basque}} +\DeclareOption{breton}{\loadDTdef{breton}} +\DeclareOption{british}{\loadDTdef{british}} +\DeclareOption{bulgarian}{\loadDTdef{bulgarian}} +\DeclareOption{catalan}{\loadDTdef{catalan}} +\DeclareOption{croatian}{\loadDTdef{croatian}} +\DeclareOption{czech}{\loadDTdef{czech}} +\DeclareOption{danish}{\loadDTdef{danish}} +\DeclareOption{dutch}{\loadDTdef{dutch}} +\DeclareOption{esperanto}{\loadDTdef{esperanto}} +\DeclareOption{estonian}{\loadDTdef{estonian}} +\DeclareOption{finnish}{\loadDTdef{finnish}} +\DeclareOption{french}{\loadDTdef{french}} +\DeclareOption{galician}{\loadDTdef{galician}} +\DeclareOption{german}{\loadDTdef{german}\dategerman} +\DeclareOption{greek}{\loadDTdef{greek}} +\DeclareOption{hebrew}{\loadDTdef{hebrew}} +\DeclareOption{icelandic}{\loadDTdef{icelandic}} +\DeclareOption{irish}{\loadDTdef{irish}} +\DeclareOption{italian}{\loadDTdef{italian}} +\DeclareOption{latin}{\loadDTdef{latin}} +\DeclareOption{lsorbian}{\loadDTdef{lsorbian}} +\DeclareOption{magyar}{\loadDTdef{magyar}} +\DeclareOption{naustrian}{\loadDTdef{naustrian}} +\DeclareOption{ngerman}{\loadDTdef{ngerman}\datengerman} +\DeclareOption{norsk}{\loadDTdef{norsk}} +\DeclareOption{polish}{\loadDTdef{polish}} +\DeclareOption{portuges}{\loadDTdef{portuges}} +\DeclareOption{romanian}{\loadDTdef{romanian}} +\DeclareOption{russian}{\loadDTdef{russian}} +\DeclareOption{samin}{\loadDTdef{samin}} +\DeclareOption{scottish}{\loadDTdef{scottish}} +\DeclareOption{serbian}{\loadDTdef{serbian}} +\DeclareOption{slovak}{\loadDTdef{slovak}} +\DeclareOption{slovene}{\loadDTdef{slovene}} +\DeclareOption{spanish}{\loadDTdef{spanish}} +\DeclareOption{swedish}{\loadDTdef{swedish}} +\DeclareOption{turkish}{\loadDTdef{turkish}} +\DeclareOption{ukraineb}{\loadDTdef{ukraineb}} +\DeclareOption{usorbian}{\loadDTdef{usorbian}} +\DeclareOption{UKenglish}{\loadDTdef{UKenglish}} +\DeclareOption{USenglish}{\loadDTdef{USenglish}} +\DeclareOption{welsh}{\loadDTdef{welsh}} % \end{macrocode} % Process package options % \begin{macrocode} @@ -1911,52 +1999,52 @@ language '\languagename', defaulting to long version}}% \if@dt@nodate \else \@ifundefined{dateenglish}{}{\let\dateenglish\longdate} -\@ifundefined{dateUKenglish}{}{\input{dt-UKenglish.def}} -\@ifundefined{dateUSenglish}{}{\input{dt-USenglish.def}} -\@ifundefined{datebritish}{}{\input{dt-british.def}} -\@ifundefined{dateamerican}{}{\input{dt-american.def}} -\@ifundefined{dateaustrian}{}{\input{dt-austrian.def}} -\@ifundefined{datebahasa}{}{\input{dt-bahasa.def}} -\@ifundefined{datebasque}{}{\input{dt-basque.def}} -\@ifundefined{datebreton}{}{\input{dt-breton.def}} -\@ifundefined{datebulgarian}{}{\input{dt-bulgarian.def}} -\@ifundefined{datecatalan}{}{\input{dt-catalan.def}} -\@ifundefined{datecroatian}{}{\input{dt-croatian.def}} -\@ifundefined{dateczech}{}{\input{dt-czech.def}} -\@ifundefined{datedanish}{}{\input{dt-danish.def}} -\@ifundefined{datedutch}{}{\input{dt-dutch.def}} -\@ifundefined{dateesperanto}{}{\input{dt-esperanto.def}} -\@ifundefined{dateestonian}{}{\input{dt-estonian.def}} -\@ifundefined{datefinnish}{}{\input{dt-finnish.def}} -\@ifundefined{datefrench}{}{\input{dt-french.def}} -\@ifundefined{dategalician}{}{\input{dt-galician.def}} -\@ifundefined{dategerman}{}{\input{dt-german.def}} -\@ifundefined{dategreek}{}{\input{dt-greek.def}} -\@ifundefined{datehebrew}{}{\input{dt-hebrew.def}} -\@ifundefined{dateicelandic}{}{\input{dt-icelandic.def}} -\@ifundefined{dateirish}{}{\input{dt-irish.def}} -\@ifundefined{dateitalian}{}{\input{dt-italian.def}} -\@ifundefined{datelatin}{}{\input{dt-latin.def}} -\@ifundefined{datelsorbian}{}{\input{dt-lsorbian.def}} -\@ifundefined{datemagyar}{}{\input{dt-magyar.def}} -\@ifundefined{datenaustrian}{}{\input{dt-naustrian.def}} -\@ifundefined{datengerman}{}{\input{dt-ngerman.def}} -\@ifundefined{datenorsk}{}{\input{dt-norsk.def}} -\@ifundefined{datepolish}{}{\input{dt-polish.def}} -\@ifundefined{dateportuges}{}{\input{dt-portuges.def}} -\@ifundefined{dateromanian}{}{\input{dt-romanian.def}} -\@ifundefined{daterussian}{}{\input{dt-russian.def}} -\@ifundefined{datesamin}{}{\input{dt-samin.def}} -\@ifundefined{datescottish}{}{\input{dt-scottish.def}} -\@ifundefined{dateserbian}{}{\input{dt-serbian.def}} -\@ifundefined{dateslovak}{}{\input{dt-slovak.def}} -\@ifundefined{dateslovene}{}{\input{dt-slovene.def}} -\@ifundefined{datespanish}{}{\input{dt-spanish.def}} -\@ifundefined{dateswedish}{}{\input{dt-swedish.def}} -\@ifundefined{dateturkish}{}{\input{dt-turkish.def}} -\@ifundefined{dateukraineb}{}{\input{dt-ukraineb.def}} -\@ifundefined{dateusorbian}{}{\input{dt-usorbian.def}} -\@ifundefined{datewelsh}{}{\input{dt-welsh.def}} +\@ifundefined{dateUKenglish}{}{\loadDTdef{UKenglish}} +\@ifundefined{dateUSenglish}{}{\loadDTdef{USenglish}} +\@ifundefined{datebritish}{}{\loadDTdef{british}} +\@ifundefined{dateamerican}{}{\loadDTdef{american}} +\@ifundefined{dateaustrian}{}{\loadDTdef{austrian}} +\@ifundefined{datebahasa}{}{\loadDTdef{bahasa}} +\@ifundefined{datebasque}{}{\loadDTdef{basque}} +\@ifundefined{datebreton}{}{\loadDTdef{breton}} +\@ifundefined{datebulgarian}{}{\loadDTdef{bulgarian}} +\@ifundefined{datecatalan}{}{\loadDTdef{catalan}} +\@ifundefined{datecroatian}{}{\loadDTdef{croatian}} +\@ifundefined{dateczech}{}{\loadDTdef{czech}} +\@ifundefined{datedanish}{}{\loadDTdef{danish}} +\@ifundefined{datedutch}{}{\loadDTdef{dutch}} +\@ifundefined{dateesperanto}{}{\loadDTdef{esperanto}} +\@ifundefined{dateestonian}{}{\loadDTdef{estonian}} +\@ifundefined{datefinnish}{}{\loadDTdef{finnish}} +\@ifundefined{datefrench}{}{\loadDTdef{french}} +\@ifundefined{dategalician}{}{\loadDTdef{galician}} +\@ifundefined{dategerman}{}{\loadDTdef{german}} +\@ifundefined{dategreek}{}{\loadDTdef{greek}} +\@ifundefined{datehebrew}{}{\loadDTdef{hebrew}} +\@ifundefined{dateicelandic}{}{\loadDTdef{icelandic}} +\@ifundefined{dateirish}{}{\loadDTdef{irish}} +\@ifundefined{dateitalian}{}{\loadDTdef{italian}} +\@ifundefined{datelatin}{}{\loadDTdef{latin}} +\@ifundefined{datelsorbian}{}{\loadDTdef{lsorbian}} +\@ifundefined{datemagyar}{}{\loadDTdef{magyar}} +\@ifundefined{datenaustrian}{}{\loadDTdef{naustrian}} +\@ifundefined{datengerman}{}{\loadDTdef{ngerman}} +\@ifundefined{datenorsk}{}{\loadDTdef{norsk}} +\@ifundefined{datepolish}{}{\loadDTdef{polish}} +\@ifundefined{dateportuges}{}{\loadDTdef{portuges}} +\@ifundefined{dateromanian}{}{\loadDTdef{romanian}} +\@ifundefined{daterussian}{}{\loadDTdef{russian}} +\@ifundefined{datesamin}{}{\loadDTdef{samin}} +\@ifundefined{datescottish}{}{\loadDTdef{scottish}} +\@ifundefined{dateserbian}{}{\loadDTdef{serbian}} +\@ifundefined{dateslovak}{}{\loadDTdef{slovak}} +\@ifundefined{dateslovene}{}{\loadDTdef{slovene}} +\@ifundefined{datespanish}{}{\loadDTdef{spanish}} +\@ifundefined{dateswedish}{}{\loadDTdef{swedish}} +\@ifundefined{dateturkish}{}{\loadDTdef{turkish}} +\@ifundefined{dateukraineb}{}{\loadDTdef{ukraineb}} +\@ifundefined{dateusorbian}{}{\loadDTdef{usorbian}} +\@ifundefined{datewelsh}{}{\loadDTdef{welsh}} \fi % \end{macrocode} % @@ -2033,20 +2121,42 @@ language '\languagename', defaulting to long version}}% %<*dt-american.def> % \end{macrocode} %\fi +%\subsection{Compatibility with Babel (Language definition files)} %\subsubsection{american} % Identify file % \begin{macrocode} -\ProvidesFile{dt-american.def}[2007/06/11] +\ProvidesFile{dt-american.def}[2010/09/21] % \end{macrocode} +%\begin{macro}{\dateamerican} +% \begin{macrocode} \let\dateamerican\usdate - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\monthnameamerican} +% \begin{macrocode} \let\monthnameamerican\monthnameenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortmonthnameamerican} +% \begin{macrocode} \let\shortmonthnameamerican\shortmonthnameenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\dayofweeknameidamerican} +% \begin{macrocode} \let\dayofweeknameidamerican\dayofweeknameidenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortdayofweeknameamerican} +% \begin{macrocode} \let\shortdayofweeknameidamerican\shortdayofweeknameidenglish - -\newcommand*{\ordinaldateamerican}[1]{#1} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinaldateamerican} +% \begin{macrocode} +\providecommand*{\ordinaldateamerican}[1]{#1} +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-american.def> @@ -2057,13 +2167,13 @@ language '\languagename', defaulting to long version}}% %<*dt-austrian.def> % \end{macrocode} %\fi -%\subsection{Compatibility with Babel (Language definition files)} %\subsubsection{Austrian} % Identify file % \begin{macrocode} \ProvidesFile{dt-austrian.def}[2004/10/31] % \end{macrocode} % Define month names. +%\begin{macro}{\monthnameaustrian} % \begin{macrocode} \providecommand{\monthnameaustrian}[1][\month]{% \@orgargctr=#1\relax @@ -2087,13 +2197,16 @@ Month numbers should go from 1 to 12}% Month numbers should go from 1 (janvier) to 12 (decembre)}% \fi} % \end{macrocode} +%\end{macro} % (Re)Define declaration to switch to this format. +%\begin{macro}{\dateaustrian} % \begin{macrocode} \DeclareRobustCommand*\dateaustrian{% \renewcommand{\formatdate}[3]{% \@day=##1\relax\@month=##2\relax\@year=##3\relax \number\@day.~\monthnameaustrian[\@month]\space\number\@year}} % \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-austrian.def> @@ -2248,12 +2361,12 @@ Month numbers should go from 1 (urtarrilaren) to 12 (abenduaren)}% %\subsubsection{Breton} % Identify file % \begin{macrocode} -\ProvidesFile{dt-breton.def}[2004/10/31] +\ProvidesFile{dt-breton.def}[2010/09/21] % \end{macrocode} %\begin{macro}{\ordinaldatebreton} % Breton version: % \begin{macrocode} -\newcommand*{\ordinaldatebreton}[1]{% +\providecommand*{\ordinaldatebreton}[1]{% #1\ifnum#1=1\/\textsuperscript{a\~n}\fi} % \end{macrocode} %\end{macro} @@ -2331,15 +2444,36 @@ Month numbers should go from 1 (Genver) to 12 (Kerzu)}% % \begin{macrocode} \ProvidesFile{dt-british.def}[2007/06/15] % \end{macrocode} +%\begin{macro}{\datebritish} +% \begin{macrocode} \let\datebritish\longdate - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\monthnamebritish} +% \begin{macrocode} \let\monthnamebritish\monthnameenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortmonthnamebritish} +% \begin{macrocode} \let\shortmonthnamebritish\shortmonthnameenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\dayofweeknameidbritish} +% \begin{macrocode} \let\dayofweeknameidbritish\dayofweeknameidenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortdayofweekidbritish} +% \begin{macrocode} \let\shortdayofweeknameidbritish\shortdayofweeknameidenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinaldatebritish} +% \begin{macrocode} \let\ordinaldatebritish\ordinaldateenglish +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-british.def> @@ -2870,12 +3004,12 @@ Month numbers should go from 1 to 12}% %\subsubsection{French} % Identify file % \begin{macrocode} -\ProvidesFile{dt-french.def}[2004/10/31] +\ProvidesFile{dt-french.def}[2010/09/21] % \end{macrocode} %\begin{macro}{\ordinaldatefrench} % French: % \begin{macrocode} -\newcommand*{\ordinaldatefrench}[1]{% +\providecommand*{\ordinaldatefrench}[1]{% #1\ifnum#1=1\ier\fi} % \end{macrocode} %\end{macro} @@ -3043,7 +3177,8 @@ Month numbers should go from 1 (janvier) to 12 (decembre)}% \or Freitag% \or Samstag% \fi} - +% \end{macrocode} +% \begin{macrocode} \providecommand{\shortdayofweeknameidgerman}[1]{% \ifcase#1\relax \or So% @@ -3238,37 +3373,12 @@ Month numbers should go from 1 to 12}% %<*dt-italian.def> % \end{macrocode} %\fi -%% -%% This is file `dt-italian.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% datetime.dtx (with options: `dt-italian.def,package') -%% Copyright (C) 2005 Nicola Talbot, all rights reserved. -%% If you modify this file, you must change its name first. -%% You are NOT ALLOWED to distribute this file alone. You are NOT -%% ALLOWED to take money for the distribution or use of either this -%% file or a changed version, except for a nominal charge for copying -%% etc. -%% \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 \~} +%\subsubsection{Italian} +% \begin{macrocode} \ProvidesFile{dt-italian.def}[2008/01/22] - -% translations provided by Giada Ermacora +% \end{macrocode} +% Translations provided by Giada Ermacora +% \begin{macrocode} \providecommand{\dayofweeknameiditalian}[1]{% \ifcase#1\relax \or domenica% @@ -3279,7 +3389,8 @@ Month numbers should go from 1 to 12}% \or venerd\`{\i}% \or sabato% \fi} - +% \end{macrocode} +% \begin{macrocode} \providecommand{\shortdayofweeknameiditalian}[1]{% \ifcase#1\relax \or dom% @@ -3290,7 +3401,8 @@ Month numbers should go from 1 to 12}% \or ven% \or sab% \fi} - +% \end{macrocode} +% \begin{macrocode} \providecommand{\monthnameitalian}[1][\month]{% \@orgargctr=#1\relax \ifcase\@orgargctr @@ -3309,7 +3421,8 @@ Month numbers should go from 1 to 12}% \or dicembre% \else \PackageError{datetime}{Invalid Month number \the\@orgargctr}{Month numbers should go from 1 (gennaio) to 12 (dicembre)}% \fi} - +% \end{macrocode} +% \begin{macrocode} \providecommand{\shortmonthnameitalian}[1][\month]{% \@orgargctr=#1\relax \ifcase\@orgargctr @@ -3329,14 +3442,13 @@ Month numbers should go from 1 to 12}% \else% \PackageError{datetime}{Invalid Month number \the\@orgargctr}{Month numbers should go from 1 (gen) to 12 (dic)}% \fi} - +% \end{macrocode} +% \begin{macrocode} \DeclareRobustCommand*\dateitalian{% \renewcommand{\formatdate}[3]{% \@day=##1\relax\@month=##2\relax\@year=##3\relax \number\@day\space\monthnameitalian[\@month]\space\number\@year}} -\endinput -%% -%% End of file `dt-italian.def'. +% \end{macrocode} %\iffalse % \begin{macrocode} %</dt-italian.def> @@ -3614,7 +3726,8 @@ Month numbers should go from 1 to 12}% \or Freitag% \or Samstag% \fi} - +% \end{macrocode} +% \begin{macrocode} \providecommand{\shortdayofweeknameidngerman}[1]{% \ifcase#1\relax \or So% @@ -3695,6 +3808,7 @@ Month numbers should go from 1 to 12}% \ProvidesFile{dt-polish.def}[2004/10/31] % \end{macrocode} % Define month names. +%\begin{macro}{\monthnamepolish} % \begin{macrocode} \providecommand{\monthnamepolish}[1][\month]{% \@orgargctr=#1\relax @@ -3718,6 +3832,7 @@ Month numbers should go from 1 to 12}% Month numbers should go from 1 to 12}% \fi} % \end{macrocode} +%\end{macro} % (Re)Define declaration to switch to this format. % \begin{macrocode} \DeclareRobustCommand*\datepolish{% @@ -3725,6 +3840,35 @@ Month numbers should go from 1 to 12}% \@day=##1\relax\@month=##2\relax\@year=##3\relax \number\@day~\monthnamepolish[\@month]\space\number\@year}} % \end{macrocode} +% The week names were provided by Piotr Kempa +%\begin{macro}{\dayofweeknameidpolish} +% \begin{macrocode} +\providecommand{\dayofweeknameidpolish}[1]{% +\ifcase#1\relax +\or Niedziela% +\or Poniedzia\l ek% +\or Wtorek% +\or \'Sroda% +\or Czwartek% +\or Pi\k atek% +\or Sobota% +\fi} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortdayofweeknameidpolish} +% \begin{macrocode} +\providecommand{\shortdayofweeknameidpolish}[1]{% +\ifcase#1\relax +\or Ndz.% +\or Pon.% +\or Wt.% +\or \'Sr.% +\or Czw.% +\or Pt.% +\or Sob.% +\fi} +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-polish.def> @@ -4325,17 +4469,38 @@ Month numbers should go from 1 to 12}% %\subsubsection{UKenglish} % Identify file % \begin{macrocode} -\ProvidesFile{dt-UKenglish.def}[2007/06/11] +\ProvidesFile{dt-UKenglish.def}[2010/07/07] % \end{macrocode} +%\begin{macro}{\dateUKenglish} +% \begin{macrocode} \let\dateUKenglish\longdate - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\monthnameUKenglish} +% \begin{macrocode} \let\monthnameUKenglish\monthnameenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortmonthnameUKenglish} +% \begin{macrocode} \let\shortmonthnameUKenglish\shortmonthnameenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\dayofweeknameidUKenglish} +% \begin{macrocode} \let\dayofweeknameidUKenglish\dayofweeknameidenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortdayofweeknameidUKenglish} +% \begin{macrocode} \let\shortdayofweeknameidUKenglish\shortdayofweeknameidenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinaldateUKenglish} +% \begin{macrocode} \let\ordinaldateUKenglish\ordinaldateenglish +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-UKenglish.def> @@ -4394,17 +4559,38 @@ Month numbers should go from 1 to 12}% %\subsubsection{USenglish} % Identify file % \begin{macrocode} -\ProvidesFile{dt-USenglish.def}[2007/06/11] +\ProvidesFile{dt-USenglish.def}[2010/07/07] % \end{macrocode} +%\begin{macro}{\dateUSenglish} +% \begin{macrocode} \let\dateUSenglish\usdate - +% \end{macrocode} +%\end{macro} +%\begin{macrocode}{\monthnameUSenglish} +% \begin{macrocode} \let\monthnameUSenglish\monthnameenglish +% \end{macrocode} +%\end{macro} +%\begin{macro}{\shortmonthnameUSenglish} +% \begin{macrocode} \let\shortmonthnameUSenglish\shortmonthnameenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\dayofweeknameidUSenglish} +% \begin{macrocode} \let\dayofweeknameidUSenglish\dayofweeknameidenglish +% \end{macrocode} +%\end{macro} +%\begin{macrocode}{\shortdayofweeknameidUSenglish} +% \begin{macrocode} \let\shortdayofweeknameidUSenglish\shortdayofweeknameidenglish - +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ordinaldateUSenglish} +% \begin{macrocode} \newcommand*{\ordinaldateUSenglish}[1]{#1} +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</dt-USenglish.def> @@ -4500,12 +4686,12 @@ Month numbers should go from 1 to 12}% %\subsubsection{Welsh} % Identify file % \begin{macrocode} -\ProvidesFile{dt-welsh.def}[2004/10/31] +\ProvidesFile{dt-welsh.def}[2010/09/21] % \end{macrocode} %\begin{macro}{\ordinaldatewelsh} % Welsh version: % \begin{macrocode} -\newcommand*{\ordinaldatewelsh}[1]{% +\providecommand*{\ordinaldatewelsh}[1]{% #1\ifnum#1=1\/\textsuperscript{a\~n}\fi} % \end{macrocode} %\end{macro} @@ -4547,5 +4733,2197 @@ Month numbers should go from 1 to 12}% %</dt-welsh.def> % \end{macrocode} %\fi +%\iffalse +% \begin{macrocode} +%<*dt-lang.tex> +% \end{macrocode} +%\fi +%\iffalse +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage[french,spanish,english]{babel} +\usepackage{datetime} % Date will be language-dependent +%\usepackage[iso]{datetime} % Date will be displayed the same for all languages + +\begin{document} +English: \today + +\selectlanguage{french} +French: \today + +\selectlanguage{spanish} +Spanish: \today + +\begin{otherlanguage}{french} +French: \today +\end{otherlanguage} + +\today +\end{document} +%\fi +%\iffalse +% \begin{macrocode} +%</dt-lang.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*dt-sampl.tex> +% \end{macrocode} +%\fi +%\iffalse +\documentclass[a4paper]{article} + +\usepackage{ifpdf} +\usepackage{datetime} + + +\ifpdf +\pdfinfo{ + /CreationDate (D:20040501215500Z) + /ModDate (D:\pdfcreationdate) +} +\fi + +\padzeroes[8] + +\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} +\newdateformat{usvardate}{\monthname[\THEMONTH]~\ordinaldate{\THEDAY}, \THEYEAR} +\newdateformat{mydate}{\ifshowdow \dayofweekname{\THEDAY}{\THEMONTH}{\THEYEAR} \fi +\THEDAY\ \monthname[\THEMONTH], \THEYEAR} +\newdateformat{yyyymmdd}{\THEYEAR\twodigit{\THEMONTH}\twodigit{\THEDAY}} +\newdateformat{ukvardate}{\THEDAY\ \monthname[\THEMONTH]\ \THEYEAR} + +\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +\newtimeformat{dashtime12}{\THEHOURXII-\twodigit{\THEMINUTE}} +\newtimeformat{hhmm}{\twodigit{\THEHOUR}\twodigit{\THEMINUTE}} + +\begin{document} + +\section{Date Formats} +Default: \today. + +\begin{tabular}{ll} +\bfseries Declaration & \bfseries\verb|\today|\\ +\verb|\longdate| & \longdate\today\\ +\verb|\shortdate| & \shortdate\today\\ +\verb|\yyyymmdddate| & \yyyymmdddate\today\\ +\verb|\ddmmyyyydate| & \ddmmyyyydate\today\\ +\verb|\dmyyyydate| & \dmyyyydate\today\\ +\verb|\ddmmyydate| & \ddmmyydate\today\\ +\verb|\dmyydate| & \dmyydate\today\\ +\verb|\textdate| & \textdate\today\\ +\verb|\usdate| & \usdate\today\\ +\verb|\mmddyyyydate| & \mmddyyyydate\today\\ +\verb|\mdyyyydate| & \mdyyyydate\today\\ +\verb|\mmddyydate| & \mmddyydate\today\\ +\verb|\mdyydate| & \mdyydate\today +\end{tabular} + +\section{Time Formats} +Default: \currenttime. + +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\ +hhmmsstime & \settimeformat{hhmmsstime}\currenttime\\ +xxivtime & \settimeformat{xxivtime}\currenttime\\ +ampmtime & \settimeformat{ampmtime}\currenttime\\ +oclock & \settimeformat{oclock}\currenttime +\end{tabular} + +\section{Specific Date:} + +\begin{tabular}{ll} +\bfseries Format & \bfseries \verb|\formatdate{1}{3}{2009}|\\ +\verb|\longdate| & \longdate\formatdate{1}{3}{2000}\\ +\verb|\shortdate| & \shortdate\formatdate{1}{3}{2000}\\ +\verb|\yyyymmdddate| & \yyyymmdddate\formatdate{1}{3}{2000}\\ +\verb|\ddmmyyyydate| & \ddmmyyyydate\formatdate{1}{3}{2000}\\ +\verb|\dmyyyydate| & \dmyyyydate\formatdate{1}{3}{2000}\\ +\verb|\ddmmyydate| & \ddmmyydate\formatdate{1}{3}{2000}\\ +\verb|\dmyydate| & \dmyydate\formatdate{1}{3}{2000}\\ +\verb|\textdate| & \textdate\formatdate{1}{3}{2000}\\ +\verb|\usdate| & \usdate\formatdate{1}{3}{2000}\\ +\verb|\mmddyyyydate| & \mmddyyyydate\formatdate{1}{3}{2000}\\ +\verb|\mdyyyydate| & \mdyyyydate\formatdate{1}{3}{2000}\\ +\verb|\mmddyydate| & \mmddyydate\formatdate{1}{3}{2000}\\ +\verb|\mdyydate| & \mdyydate\formatdate{1}{3}{2000} +\end{tabular} + +\section{Specific Time} + +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\formattime{15}{45}{00}|\\ +hhmmsstime & \settimeformat{hhmmsstime}\formattime{15}{45}{00}\\ +xxivtime & \settimeformat{xxivtime}\formattime{15}{45}{00}\\ +ampmtime & \settimeformat{ampmtime}\formattime{15}{45}{00}\\ +oclock & \settimeformat{oclock}\formattime{15}{45}{00} +\end{tabular} + +\vskip\baselineskip\noindent +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\formattime{0}{0}{0}|\\ +hhmmsstime & \settimeformat{hhmmsstime}\formattime{0}{0}{0}\\ +xxivtime & \settimeformat{xxivtime}\formattime{0}{0}{0}\\ +ampmtime & \settimeformat{ampmtime}\formattime{0}{0}{0}\\ +oclock & \settimeformat{oclock}\formattime{0}{0}{0} +\end{tabular} + +\vskip\baselineskip\noindent +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\formattime{12}{0}{0}|\\ +hhmmsstime & \settimeformat{hhmmsstime}\formattime{12}{0}{0}\\ +xxivtime & \settimeformat{xxivtime}\formattime{12}{0}{0}\\ +ampmtime & \settimeformat{ampmtime}\formattime{12}{0}{0}\\ +oclock & \settimeformat{oclock}\formattime{12}{0}{0} +\end{tabular} + +\section{Defining New Dates} + +\begin{tabular}{ll} +\verb|\dashdate| & \dashdate\today\\ +\verb|\usvardate| & \usvardate\today\\ +\verb|\ukvardate| & \ukvardate\today\\ +\verb|\mydate| & \mydate\today\\ +\verb|\yyyymmdd| & \yyyymmdd\today\\ +\verb|\dashdate| & \dashdate\formatdate{8}{3}{2000}\\ +\verb|\usvardate| & \usvardate\formatdate{8}{3}{2000}\\ +\verb|\mydate| & \mydate\formatdate{8}{3}{2000}\\ +\verb|\yyyymmdd| & \yyyymmdd\formatdate{8}{3}{2000} +\end{tabular} + +\section{Defining New Times} + +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\ +dottime & \settimeformat{dottime}\currenttime\\ +dashtime12 & \settimeformat{dashtime12}\currenttime\\ +hhmm & \settimeformat{hhmm}\currenttime +\end{tabular} + +\end{document} +%\fi +%\iffalse +% \begin{macrocode} +%</dt-sampl.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*datetime.perl> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +# File : datetime.perl +# Author : Nicola Talbot +# Date : 17 Nov 2009 +# Version : 1.04 +# +# This is a LaTeX2HTML style implementing the datetime package, and +# is distributed as part of that package. +# Copyright 2007 Nicola L.C. 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. + +# set up default values for internal counters. + +($global{SECONDS},$global{MINUTE},$global{HOUR},$global{DAY},$global{MONTH},$global{YEAR})=localtime(time); +$global{YEAR} += 1900; +$global{MONTH}++; + +package main; + +&do_require_package('fmtcount'); + +sub do_cmd_ordinaldate{ + &do_cmd_ordinalnum(@_); +} + +# define package options + +sub do_datetime_long{ + &do_cmd_longdate(@_); +} + +sub do_datetime_short{ + &do_cmd_shortdate(@_); +} + +sub do_datetime_text{ + &do_cmd_textdate(@_); +} + +sub do_datetime_yyyymmdd{ + &do_cmd_yyyymmdddate(@_); +} + +sub do_datetime_ddmmyyyy{ + &do_cmd_ddmmyyyydate(@_); +} + +sub do_datetime_dmyyyy{ + &do_cmd_dmyyyydate(@_); +} + +sub do_datetime_ddmmyy{ + &do_cmd_ddmmyydate(@_); +} + +sub do_datetime_dmyy{ + &do_cmd_dmyyyydate(@_); +} + +sub do_datetime_us{ + &do_cmd_usdate(@_); +} + +sub do_datetime_mmddyyyy{ + &do_cmd_mmddyyyydate(@_); +} + +sub do_datetime_mdyyyy{ + &do_cmd_mdyyyydate(@_); +} + +sub do_datetime_mmddyy{ + &do_cmd_mmddyydate(@_); +} + +sub do_datetime_mdyy{ + &do_cmd_mdyyyydate(@_); +} + +sub do_datetime_raise{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", "<SUP>",$num,"</SUP>",$_);'; + $tmp .='}'; + + eval($tmp); +} + +sub do_datetime_level{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", $num,$_);'; + $tmp .='}'; + + eval($tmp); +} + +sub do_datetime_dayofweek{ + &do_cmd_showdowtrue(@_); +} + +sub do_datetime_nodayofweek{ + &do_cmd_showdowfalse(@_); +} + +sub do_datetime_hhmmss{ + &set_timeformat_hhmmsstime +} + +sub do_datetime_24hr{ + &set_timeformat_xxivtime +} + +&do_datetime_24hr; + +sub do_datetime_12hr{ + &set_timeformat_ampmtime +} + +sub do_datetime_oclock{ + &set_timeformat_oclock +} + +sub do_datetime_iso{ + &set_timeformat_hhmmsstime; + &do_cmd_yyyymmdddate; + eval('sub do_cmd_dateseparator{join(\'\', \'-\', $_[0]);}'); + eval('sub do_cmd_timeseparator{join(\'\', \':\', $_[0]);}'); +} + +# babel stuff (Month will already be redefined by babel, so only need to change $dateformat) + +sub do_datetime_austrian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateaustrian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateaustrian(@_); +} + +if (defined &austrian_today) +{ + &do_datetime_austrian(@_); +} + +sub do_datetime_bahasa{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebahasa{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebahasa(@_); +} + +if (defined &bahasa_today) +{ + &do_datetime_bahasa(@_); +} + +sub do_datetime_basque{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebasque{'; + $tmp .= ' $dateformat = "THEYEAR.eko MONTHNAME[THEMONTH] THEDAY";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebasque(@_); +} + +if (defined &basque_today) +{ + &do_datetime_basque(@_); +} + +sub do_datetime_breton{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebreton{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ a viz MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'a\~n\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebreton(@_); +} + +if (defined &breton_today) +{ + &do_datetime_breton(@_); +} + +sub do_datetime_bulgarian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebulgarian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR \\cyrg.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebulgarian(@_); +} + +if (defined &bulgarian_today) +{ + &do_datetime_bulgarian(@_); +} + +sub do_datetime_catalan{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datecatalan{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datecatalan(@_); +} + +if (defined &catalan_today) +{ + &do_datetime_catalan(@_); +} + +sub do_datetime_croatian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datecroatian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datecroatian(@_); +} + +if (defined &croatian_today) +{ + &do_datetime_croatian(@_); +} + +sub do_datetime_czech{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateczech{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateczech(@_); +} + +if (defined &czech_today) +{ + &do_datetime_czech(@_); +} + +sub do_datetime_danish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datedanish{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datedanish(@_); +} + +if (defined &danish_today) +{ + &do_datetime_danish(@_); +} + +sub do_datetime_dutch{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datedutch{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datedutch(@_); +} + +if (defined &dutch_today) +{ + &do_datetime_dutch(@_); +} + +sub do_datetime_esperanto{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateesperanto{'; + $tmp .= ' $dateformat = "THEDAY--a de MONTHNAME[THEMONTH], THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateesperanto(@_); +} + +if (defined &esperanto_today) +{ + &do_datetime_esperanto(@_); +} + +sub do_datetime_estonian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateestonian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR. a.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateestonian(@_); +} + +if (defined &estonian_today) +{ + &do_datetime_estonian(@_); +} + +sub do_datetime_finnish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datefinnish{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datefinnish(@_); +} + +if (defined &finnish_today) +{ + &do_datetime_finnish(@_); +} + +sub do_datetime_french{ + local($tmp) = ""; + + eval($tmp); + $tmp .= 'sub do_cmd_datefrench{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'\ier\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datefrench(@_); +} + +if (defined &french_today) +{ + &do_datetime_french(@_); +} + +sub do_datetime_galician{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategalician{'; + $tmp .= ' $dateformat = "THEDAY de MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategalician(@_); +} + +if (defined &galician_today) +{ + &do_datetime_galician(@_); +} + +sub do_datetime_german{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategerman{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategerman(@_); +} + +if (defined &german_today) +{ + &do_datetime_german(@_); +} + +sub do_datetime_greek{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategreek{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategreek(@_); +} + +if (defined &greek_today) +{ + &do_datetime_greek(@_); +} + +sub do_datetime_icelandic{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateicelandic{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateicelandic(@_); +} + +if (defined &icelandic_today) +{ + &do_datetime_icelandic(@_); +} + +sub do_datetime_irish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateirish{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateirish(@_); +} + +if (defined &irish_today) +{ + &do_datetime_irish(@_); +} + +sub do_datetime_italian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateitalian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateitalian(@_); +} + +if (defined &italian_today) +{ + &do_datetime_italian(@_); +} + +sub do_datetime_latin{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datelatin{'; + $tmp .= ' $dateformat = "ROMANNUMERALU{THEDAY} MONTHNAME[THEMONTH] ROMANNUMERALU{THEYEAR}";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datelatin(@_); +} + +if (defined &latin_today) +{ + &do_datetime_latin(@_); +} + +sub do_datetime_lsorbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datelsorbian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datelsorbian(@_); +} + +if (defined &lsorbian_today) +{ + &do_datetime_lsorbian(@_); +} + +sub do_datetime_magyar{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datemagyar{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datemagyar(@_); +} + +if (defined &magyar_today) +{ + &do_datetime_magyar(@_); +} + +sub do_datetime_naustrian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenaustrian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenaustrian(@_); +} + +if (defined &naustrian_today) +{ + &do_datetime_naustrian(@_); +} + +sub do_datetime_ngerman{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datengerman{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datengerman(@_); +} + +if (defined &ngerman_today) +{ + &do_datetime_ngerman(@_); +} + +sub do_datetime_norsk{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenorsk{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenorsk(@_); +} + +if (defined &norsk_today) +{ + &do_datetime_norsk(@_); +} + +sub do_datetime_polish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenorsk{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenorsk(@_); +} + +if (defined &polish_today) +{ + &do_datetime_polish(@_); +} + +sub do_datetime_portuges{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateportuges{'; + $tmp .= ' $dateformat = "THEDAY de MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateportuges(@_); +} + +if (defined &portuges_today) +{ + &do_datetime_portuges(@_); +} + +sub do_datetime_romanian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateromanian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateromanian(@_); +} + +if (defined &romanian_today) +{ + &do_datetime_romanian(@_); +} + +sub do_datetime_russian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_daterussian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR \\\\cyrg.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_daterussian(@_); +} + +if (defined &russian_today) +{ + &do_datetime_russian(@_); +} + +sub do_datetime_samin{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datesamin{'; + $tmp .= ' $dateformat = "MONTHNAME[THEMONTH] THEDAY.~b. THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datesamin(@_); +} + +if (defined &samin_today) +{ + &do_datetime_samin(@_); +} + +sub do_datetime_scottish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datescottish{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datescottish(@_); +} + +if (defined &scottish_today) +{ + &do_datetime_scottish(@_); +} + +sub do_datetime_serbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateserbian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateserbian(@_); +} + +if (defined &serbian_today) +{ + &do_datetime_serbian(@_); +} + +sub do_datetime_slovak{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateslovak{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateslovak(@_); +} + +if (defined &slovak_today) +{ + &do_datetime_slovak(@_); +} + +sub do_datetime_slovene{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateslovene{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateslovene(@_); +} + +if (defined &slovene_today) +{ + &do_datetime_slovene(@_); +} + +sub do_datetime_spanish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datespanish{'; + $tmp .= ' $dateformat = "THEDAY~de MONTHNAME[THEMONTH] de~THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datespanish(@_); +} + +if (defined &spanish_today) +{ + &do_datetime_spanish(@_); +} + +sub do_datetime_swedish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateswedish{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = ""; + $tmp .= 'sub do_cmd_datesymd{'; + $tmp .= ' $dateformat = "THEYEAR-TWODIGIT{THEMONTH}-TWODIGIT{THEDAY}";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = ""; + $tmp .= 'sub do_cmd_datesdmy{'; + $tmp .= ' $dateformat = "THEDAY/THEMONTH THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateswedish(@_); +} + +if (defined &swedish_today) +{ + &do_datetime_swedish(@_); +} + +sub do_datetime_turkish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateturkish{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateturkish(@_); +} + +if (defined &turkish_today) +{ + &do_datetime_turkish(@_); +} + +sub do_datetime_ukraineb{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateukraineb{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR~\\\\cyrr.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateukraineb(@_); +} + +if (defined &ukraineb_today) +{ + &do_datetime_ukraineb(@_); +} + +sub do_datetime_usorbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateusorbian{'; + $tmp .= ' $dateformat = "THEDAY.~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateusorbian(@_); +} + +if (defined &usorbian_today) +{ + &do_datetime_usorbian(@_); +} + +sub do_datetime_welsh{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datewelsh{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ a viz MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'a\~n\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datewelsh(@_); +} + +if (defined &welsh_today) +{ + &do_datetime_welsh(@_); +} + +# As far as I know, LaTeX2HTML doesn't implement TeX conditionals. +# $showdow corresponds to LaTeX boolean variable showdow +$showdow = 1; + +sub get_monthname{ + local($month) = @_; + + if ($month eq 'THEMONTH' or $month eq '\THEMONTH') + { + # this is a cludge to help newdateformat work + + 'MONTHNAME[THEMONTH]'; + } + else + { + if ($month eq '') + { + local($today) = &get_date(); + $today =~ m|(\d+)/0?(\d+)/|; + $month = $1; + } + + $Month[$month]; + } +} + +sub do_cmd_monthname{ + local($_) = @_; + local($month,$pat) = &get_next_optional_argument; + + local($monthname) = &get_monthname($month); + join('',$monthname,$_); +} + +sub get_shortmonthname{ + local($month) = @_; + + if ($month eq 'THEMONTH' or $month eq '\THEMONTH') + { + 'SHORTMONTHNAME[THEMONTH]'; + } + else + { + substr(&get_monthname($month), 0, 3); + } +} + +sub do_cmd_shortmonthname{ + local($_) = @_; + local($month,$pat) = &get_next_optional_argument; + + local($monthname) = &get_shortmonthname($month); + + join('',$monthname,$_); +} + +sub is_leap_year{ + local($year) = @_; + local($isleapyear) = 0; + + if (($year%400) == 0) + { + # year mod 400 = 0 => leap year + + $isleapyear = 1; + } + elsif (($year%100) == 0) + { + # year mod 100 = 0 and year mod 400 != 0 => not a leap year + + $isleapyear = 0; + } + elsif (($year%4) == 0) + { + # year mod 4 = 0 and year mod 100 != 0 => leap year + + $isleapyear = 1; + } + + $isleapyear; +} + +sub get_day_of_year{ + local($day,$month,$year) = @_; + local($dayofyear) = 0; + + SWITCH: { + if ($month == 2) {$dayofyear += 31; last SWITCH; } + if ($month == 3) {$dayofyear += 59; last SWITCH; } + if ($month == 4) {$dayofyear += 90; last SWITCH; } + if ($month == 5) {$dayofyear += 120; last SWITCH; } + if ($month == 6) {$dayofyear += 151; last SWITCH; } + if ($month == 7) {$dayofyear += 181; last SWITCH; } + if ($month == 8) {$dayofyear += 212; last SWITCH; } + if ($month == 9) {$dayofyear += 243; last SWITCH; } + if ($month == 10) {$dayofyear += 273; last SWITCH; } + if ($month == 11) {$dayofyear += 304; last SWITCH; } + if ($month == 12) {$dayofyear += 334; last SWITCH; } + } + + if ($month > 2 && &is_leap_year($year)) + { + $dayofyear += 1; + } + + $dayofyear += $day; + local($_)=$dayofyear; +} + +sub get_day_of_week{ + local($day,$month,$year) = @_; + local($dayofyear) = &get_day_of_year($day,$month,$year); + local($_) = (((($year-1901)%28)*1.25 + 2)%7 + $dayofyear - 1)%7 + 1; +} + +sub get_day_of_weekname_english{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_french{ + local($dow) = @_; + + local(@DayOfWeek) = ('dimanche', + 'lundi', + 'mardi', + 'mercredi', + 'jeudi', + 'vendredi', + 'samedi'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_spanish{ + local($dow) = @_; + + local(@DayOfWeek) = ('domingo', + 'lunes', + 'martes', + 'mi\\\'ercoles', + 'jueves', + 'viernes', + 's\\\'abado'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_portuges{ + local($dow) = @_; + + local(@DayOfWeek) = ('domingo', + 'segunda-feira', + 'ter\c{c}a-feira', + 'quarta-feira', + 'quinta-feira', + 'sexta-feira', + 'sabado'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_german{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_ngerman{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname{ + local($dow)=@_; + local($dowsub); + + $dowsub = "get_day_of_weekname_$default_language"; + + if (defined ($dowsub)) + { + &$dowsub($dow); + } + else + { + &get_day_of_weekname_english($dow); + } +} + +sub get_short_day_of_weekname_english{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sun', + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_short_day_of_weekname_german{ + local($dow) = @_; + + local(@DayOfWeek) = ('So', + 'Mo', + 'Di', + 'Mi', + 'Do', + 'Fr', + 'Sa'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_short_day_of_weekname_ngerman{ + local($dow) = @_; + + local(@DayOfWeek) = ('So', + 'Mo', + 'Di', + 'Mi', + 'Do', + 'Fr', + 'Sa'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_short_day_of_weekname{ + local($dow)=@_; + local($dowsub); + + $dowsub = "get_short_day_of_weekname_$default_language"; + + if (defined ($dowsub)) + { + &$dowsub($dow); + } + else + { + substr(&get_day_of_weekname($dow),0,3); + } +} + +sub do_cmd_dayofweeknameid{ + local($_) = @_; + local($dow); + + $dow = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($dow=$2)); + + join('',&get_day_of_weekname($dow), $_); +} + +sub do_cmd_dayofweekname{ + local($_) = @_; + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($year=$2)); + + if ($day eq 'THEDAY' or $day eq '\THEDAY') + { + # this is a cludge to help newdateformat work + + join('', '{DOW}', $_); + } + else + { + local($dow) = &get_day_of_week($day,$month,$year); + + join('',&get_day_of_weekname($dow), $_); + } +} + +sub do_cmd_shortdayofweekname{ + local($_) = @_; + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($year=$2)); + + local($dow) = &get_day_of_week($day,$month,$year); + + join('',&get_short_day_of_weekname($dow), $_); +} + +sub do_cmd_thisdayofweekname{ + local($dow) = &get_day_of_week($global{DAY}, $global{MONTH}, $global{YEAR}); + + join('',$DayOfWeek[$dow], $_); +} + +sub do_cmd_thisshortdayofweekname{ + local($dow) = &get_day_of_week($global{DAY}, $global{MONTH}, $global{YEAR}); + + join('',&get_short_day_of_weekname($dow), $_); +} + +$dateformat = "\\ifshowdow{DOW}\\fi {ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH], THEYEAR"; + +sub format_date{ + local($day,$month,$year) = @_; + + local($str) = $dateformat; + + $str =~ s/THEDAY/$day/g; + $str =~ s/THEMONTH/$month/g; + $str =~ s/THEYEAR/$year/g; + + $str =~ s/TWODIGIT{([\d]+)}/&get_twodigit($1)/eg; + $str =~ s/ROMANNUMERAL{([\d]+)}/&froman($1)/eg; + $str =~ s/ROMANNUMERALU{([\d]+)}/uc(&froman($1))/eg; + $str =~ s/TRUNCATE{([\d]+)}/&get_twodigit($1%100)/eg; + $str =~ s/SHORTMONTHNAME\[([\d]+)\]/&get_shortmonthname($1)/eg; + $str =~ s/MONTHNAME\[([\d]+)\]/&get_monthname($1)/eg; + + local($X) = ++$global{'max_id'}; + local($Y) = ++$global{'max_id'}; + local($Z) = ++$global{'max_id'}; + $str =~ s/{DOW}/\\dayofweekname${OP}$X${CP}$day${OP}$X${CP}${OP}$Y${CP}$month${OP}$Y${CP}${OP}$Z${CP}$year${OP}$Z${CP}/g; + $str =~ s/{SDOW}/\\shortdayofweekname${OP}$X${CP}$day${OP}$X${CP}${OP}$Y${CP}$month${OP}$Y${CP}${OP}$Z${CP}$year${OP}$Z${CP}/g; + + local($br_id) = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($day); + $str =~ s/{ORDINAL{DAY}}/$day\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + $br_id = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($month); + $str =~ s/{ORDINAL{MONTH}}/$month\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + $br_id = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($year); + $str =~ s/{ORDINAL{YEAR}}/$year\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + local($br_id) = ++$global{'max_id'}; + $str =~ s/{ORDINALDATE{DAY}}/\\ordinaldate${OP}$br_id${CP}$day${OP}$br_id${CP}/g; + + $str =~ s/{NNUMBERSTRING{DAY}}/&get_Numberstring($day)/eg; + $str =~ s/{NNUMBERSTRING{MONTH}}/&get_Numberstring($month)/eg; + $str =~ s/{NNUMBERSTRING{YEAR}}/&get_Numberstring($year)/eg; + + $str =~ s/{OORDINALSTRING{DAY}}/&get_Ordinalstring($day)/eg; + $str =~ s/{OORDINALSTRING{MONTH}}/&get_Ordinalstring($month)/eg; + $str =~ s/{OORDINALSTRING{YEAR}}/&get_Ordinalstring($year)/eg; + + $str =~ s/{CAPNUMBERSTRING{DAY}}/uc(&get_numberstring($day))/eg; + $str =~ s/{CAPNUMBERSTRING{MONTH}}/uc(&get_numberstring($month))/eg; + $str =~ s/{CAPNUMBERSTRING{YEAR}}/uc(&get_numberstring($year))/eg; + + $str =~ s/{CAPORDINALSTRING{DAY}}/uc(&get_ordinalstring($day))/eg; + $str =~ s/{CAPORDINALSTRING{MONTH}}/uc(&get_ordinalstring($month))/eg; + $str =~ s/{CAPORDINALSTRING{YEAR}}/uc(&get_ordinalstring($year))/eg; + + $str =~ s/{NUMBERSTRING{DAY}}/&get_numberstring($day)/eg; + $str =~ s/{NUMBERSTRING{MONTH}}/&get_numberstring($month)/eg; + $str =~ s/{NUMBERSTRING{YEAR}}/&get_numberstring($year)/eg; + + $str =~ s/{ORDINALSTRING{DAY}}/&get_ordinalstring($day)/eg; + $str =~ s/{ORDINALSTRING{MONTH}}/&get_ordinalstring($month)/eg; + $str =~ s/{ORDINALSTRING{YEAR}}/&get_ordinalstring($year)/eg; + + $str; +} + +sub do_cmd_formatdate{ + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year=$2)); + + join('', &format_date($day,$month,$year), $_[0]); +} + +sub do_cmd_today{ + join('', &format_date($global{DAY},$global{MONTH},$global{YEAR}), $_[0]); +} + +sub do_cmd_day{ + join('', $global{DAY}, $_[0]); +} + +sub do_cmd_month{ + join('', $global{MONTH}, $_[0]); +} + +sub do_cmd_year{ + join('', $global{YEAR}, $_[0]); +} + +sub do_cmd_showdowtrue{ + local($_) = @_; + $showdow = 1; + $_[0]; +} + +sub do_cmd_showdowfalse{ + local($_) = @_; + $showdow = 0; + $_[0]; +} + +# This is a bit primative, it doesn't allow for +# nested conditionals + +sub do_cmd_ifshowdow{ + local($_) = @_; + local($ifbit,$elsebit); + + $_[0] =~s/(.*)\\fi//; + + $ifbit = $1; + + $ifbit =~s/(.*)\\else(.*)/\1/g; + + $elsebit = $2; + + if ($showdow) + { + join('', $ifbit, $_[0]); + } + else + { + join('', $elsebit, $_[0]); + } +} + +sub do_cmd_dateseparator{ + join('', '/', $_[0]); +} + +sub do_cmd_longdate{ + $dateformat = "\\ifshowdow{DOW}\\fi {ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH], THEYEAR"; + + $_[0]; +} + +sub do_cmd_shortdate{ + $dateformat = "\\ifshowdow{SDOW}\\fi {ORDINALDATE{DAY}}\\ SHORTMONTHNAME[THEMONTH], THEYEAR"; + + $_[0]; +} + +sub do_cmd_yyyymmdddate{ + $dateformat = "THEYEAR\\dateseparator TWODIGIT{THEMONTH}\\dateseparator TWODIGIT{THEDAY}"; + + $_[0]; +} + +sub do_cmd_ddmmyyyydate{ + $dateformat = "TWODIGIT{THEDAY}\\dateseparator TWODIGIT{THEMONTH}\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_dmyyyydate{ + $dateformat = "THEDAY\\dateseparator THEMONTH\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_dmyydate{ + $dateformat = "THEDAY\\dateseparator THEMONTH\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_ddmmyydate{ + $dateformat = "TWODIGIT{THEDAY}\\dateseparator TWODIGIT{THEMONTH}\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_textdate{ + $dateformat = "\\ifshowdow{DOW} the\\fi {OORDINALSTRING{DAY}} of MONTHNAME[THEMONTH], {NNUMBERSTRING{YEAR}}"; + + $_[0]; +} + +sub do_cmd_usdate{ + $dateformat = "MONTHNAME[THEMONTH] THEDAY, THEYEAR"; + + $_[0]; +} + +sub do_cmd_mmddyyyydate{ + $dateformat = "TWODIGIT{THEMONTH}\\dateseparator TWODIGIT{THEDAY}\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_mdyyyydate{ + $dateformat = "THEMONTH\\dateseparator THEDAY\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_mmddyydate{ + $dateformat = "TWODIGIT{THEMONTH}\\dateseparator TWODIGIT{THEDAY}\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_mdyydate{ + $dateformat = "THEMONTH\\dateseparator THEDAY\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_THEYEAR{ + join('', 'THEYEAR', $_[0]); +} + +sub do_cmd_THEMONTH{ + join('', 'THEMONTH', $_[0]); +} + +sub do_cmd_THEDAY{ + join('', 'THEDAY', $_[0]); +} + +sub do_cmd_newdateformat{ + local($_) = @_; + local($cmd,$cmdbody); + local($ntmp); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + $cmdbody = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmdbody=$2)); + + $ntmp = 'sub do_cmd_' . $cmd . '{'; + $ntmp .= '$dateformat = "' . $cmdbody . '";'; + + $ntmp .= '$_[0];'; + $ntmp .= '}'; + + eval($ntmp); + + join('', $_[0]); +} + +sub do_cmd_pdfdate{ + local($_) = @_; + + local($timestring) = sprintf "%d%02d%02d%02d%02d%02d", + $global{YEAR}, $global{MONTH}, $global{DAY}, $global{HOUR}, $global{MINUTE}, $global{SECONDS}; + + join('', $timestring, $_[0]); +} + + %userdates = (); + +sub do_cmd_newdate{ + local($_)=@_; + local($datename,$mon,$day,$year); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + $day = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + + $mon = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($mon =$2)); + + $year = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year =$2)); + + + $userdates{$datename}{day} = $day; + $userdates{$datename}{month} = $mon; + $userdates{$datename}{year} = $year; + + join('', $_[0]); +} + +sub do_cmd_displaydate{ + local($_)=@_; + local($datename); + local($cmd,$br_id); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + $br_id = ++$global{'max_id'}; + $cmd = "$OP$br_id$CP" . $userdates{$datename}{day} ."$OP$br_id$CP"; + $br_id = ++$global{'max_id'}; + $cmd .= "$OP$br_id$CP" . $userdates{$datename}{month} ."$OP$br_id$CP"; + $br_id = ++$global{'max_id'}; + $cmd .= "$OP$br_id$CP" . $userdates{$datename}{year} ."$OP$br_id$CP"; + + join('', '\formatdate', $cmd, $_[0]); +} + +sub do_cmd_getdateyear{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{year}, $_[0]); +} + +sub do_cmd_getdatemonth{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{month}, $_[0]); +} + +sub do_cmd_getdateday{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{day}, $_[0]); +} + +# time commands + +sub do_cmd_timeseparator{ + join('', ':', $_[0]); +} + +sub do_cmd_noon{ + local($_) = @_; + + join('', "Noon", $_[0]); +} + +sub do_cmd_midnight{ + local($_) = @_; + + join('', "Midnight", $_[0]); +} + +sub do_cmd_amname{ + local($_) = @_; + + join('', "am", $_[0]); +} + +sub do_cmd_pmname{ + local($_) = @_; + + join('', "pm", $_[0]); +} + +sub do_cmd_amstring{ + local($_) = @_; + + join('', "in the morning", $_[0]); +} + +sub do_cmd_pmstring{ + local($_) = @_; + + join('', "in the afternoon", $_[0]); +} + +sub do_cmd_halfpast{ + local($_) = @_; + + join('', "Half past", $_[0]); +} + +sub do_cmd_quarterpast{ + local($_) = @_; + + join('', "Quarter past", $_[0]); +} + +sub do_cmd_quarterto{ + local($_) = @_; + + join('', "Quarter to", $_[0]); +} + +sub do_cmd_oclockstring{ + local($_) = @_; + + join('', "O'Clock", $_[0]); +} + +sub do_cmd_amorpmname{ + if ($global{HOUR}>12) + { + &do_cmd_pmname; + } + else + { + &do_cmd_amname; + } +} + +sub do_cmd_amorpmstring{ + if ($global{HOUR}>12) + { + &do_cmd_pmstring; + } + else + { + &do_cmd_amstring; + } +} + +sub set_timeformat_hhmmsstime{ + $timeformat = "TWODIGIT{THEHOUR}\\timeseparator TWODIGIT{THEMINUTE}" + . "\\timeseparator TWODIGIT{THESECOND}"; +} + +sub set_timeformat_xxivtime{ + $timeformat = "TWODIGIT{THEHOUR}\\timeseparator TWODIGIT{THEMINUTE}"; +} + +sub format_ampmtime{ + local($hour,$min)=@_; + local($timestring); + local($hourxii) = ($hour == 12 ? 12 : ($hour)%12); + + $timestring = sprintf "%d\\timeseparator %02d", $hourxii, $min; + + $timestring .= ($hour < 12 ? + "\\amname " : ($hour = 12 ? " \\noon" :"\\pmname ")); + + $timestring +} + +sub do_cmd_ampmtime{ + local($_) = @_; + + join('', &format_ampm($global{HOUR},$global{MINUTE}), $_[0]); +} + +sub do_cmd_timeformat_at_ampmtime{ + local($hour,$min,$sec); + # read 1st argument + $hour = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $min = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $sec = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year=$2)); + + join('', &format_ampmtime($hour, $min), $_[0]); +} + +sub do_cmd_timeformatATampmtime{&do_cmd_timeformat_at_ampmtime} + +sub set_timeformat_ampmtime{ + $timeformat = "TWODIGIT{THEHOURXII}\\timeseparator TWODIGIT{THEMINUTE}AMORPMNAME"; +} + +sub format_oclock{ + local($hour,$min)=@_; + + local($hourxii) = ($hour == 12 ? 12 : ($hour)%12); + local($tohour) = ($hour == 11 ? 12 :($hour+1)%12); + local($tominute) = ($min == 0? 0 : 60 - $min); + + local($timestring); + + if ($hour == 0 && $min == 0) + { + $timestring = "\\midnight"; + } + elsif ($hour == 12 && $min == 0) + { + $timestring = "\\noon"; + } + else + { + if ($min == 0) + { + $timestring = &get_Numberstring($hourxii) . " \\oclockstring"; + } + elsif ($min == 15) + { + $timestring = "\\quarterpast\\ " . &get_Numberstring($hourxii); + } + elsif ($min == 30) + { + $timestring = "\\halfpast\\ " . &get_Numberstring($hourxii); + } + elsif ($min == 45) + { + $timestring = "\\quarterto\\ " . &get_Numberstring($tohour); + } + elsif ($min < 30) + { + $timestring = get_Numberstring($min); + + $timestring .= ($min == 1 ? " minute" : " minutes") . " past "; + + $timestring .= get_Numberstring($hourxii); + } + else + { + $timestring = get_Numberstring($tominute); + + $timestring .= ($min == 1 ? " minute" : " minutes") . " to "; + + $timestring .= get_Numberstring($tohour); + } + + $timestring .= ($hour < 12 ? " \\amstring" : " \\pmstring"); + } + + $timestring +} + +sub do_cmd_oclock{ + local($_) = @_; + + join('', &format_oclock($global{HOUR},$global{MINUTE}), $_[0]); +} + +sub do_cmd_timeformat_at_oclock{ + local($hour,$min,$sec); + # read 1st argument + $hour = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $min = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $sec = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year=$2)); + + join('', &format_oclock($hour, $min), $_[0]); +} + +sub do_cmd_timeformatAToclock{&do_cmd_timeformat_at_oclock} + +sub set_timeformat_oclock{ + $timeformat="OCLOCK"; +} + +sub do_cmd_formattime{ + local($_) = @_; + local($hour,$min,$sec); + + # read 1st argument + $hour = &missing_braces unless + (s/$next_pair_pr_rx/$hour=$2;''/eo); + # read 2nd argument + $min = &missing_braces unless + (s/$next_pair_pr_rx/$min=$2;''/eo); + # read 3rd argument + $sec = &missing_braces unless + (s/$next_pair_pr_rx/$sec=$2;''/eo); + + join('', &format_time($hour,$min,$sec), $_); +} + +sub do_cmd_currenttime{ + join('', &format_time($global{HOUR},$global{MINUTE},$global{SECONDS}), $_[0]); +} + +sub format_time{ + local($hour,$min,$sec) = @_; + + local($str) = $timeformat; + + local($hourxii) = ($hour == 12 ? 12 : ($hour)%12); + local($tohour) = ($hour == 11 ? 12 :($hour+1)%12); + local($tominute) = ($min == 0? 0 : 60 - $min); + local($amorpmname) = ($hour < 12 ? '\amname' : + ($hour == 12 ? ' \noon' : '\pmname')); + + $str =~ s/THEHOURXII/$hourxii/g; + $str =~ s/THEHOUR/$hour/g; + $str =~ s/THEMINUTE/$min/g; + $str =~ s/THESECOND/$sec/g; + $str =~ s/THETOHOUR/$tohour/g; + $str =~ s/THETOMINUTE/$tominute/g; + $str =~ s/AMORPMNAME/$amorpmname/g; + + $str =~ s/TWODIGIT{([\d]+)}/&get_twodigit($1)/eg; + $str =~ s/ROMANNUMERAL{([\d]+)}/&froman($1)/eg; + $str =~ s/ROMANNUMERALU{([\d]+)}/uc(&froman($1))/eg; + + $str =~ s/OCLOCK/&format_oclock($hour,$min)/eg; + + $str; +} + +sub do_cmd_settimeformat{ + local($_) = @_; + local($cmd); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + + eval('&set_timeformat_'.$cmd); + + $_[0]; +} + +sub do_cmd_newtimeformat{ + local($_) = @_; + local($cmd,$cmdbody); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + $cmdbody = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmdbody=$2)); + + $tmp = 'sub do_cmd_'.$cmd.'{&do_cmd_timeformat_at_'.$cmd.';}'; + eval($tmp); + + $tmp = 'sub set_timeformat_'.$cmd.'{'; + $tmp .= '$timeformat = "'.$cmdbody .'";'; + $tmp .= '}'; + eval($tmp); + + $tmp = 'sub do_cmd_timeformat_at_'.$cmd.'{'; + $tmp .= 'local($_)=@_;'; + $tmp .= 'local($hour,$min,$sec);'; + $tmp .= '$hour=&missing_braces unless '; + $tmp .= '((s/$next_pair_pr_rx//o)&&($hour=$2));'; + $tmp .= '$min=&missing_braces unless '; + $tmp .= '((s/$next_pair_pr_rx//o)&&($min=$2));'; + $tmp .= '$sec=&missing_braces unless '; + $tmp .= '((s/$next_pair_pr_rx//o)&&($sec=$2));'; + $tmp .= '&set_timeformat_'.$cmd.';'; + $tmp .= '&format_time($hour, $min, $sec).$_'; + $tmp .= "}"; + + eval($tmp); + + join('', $_[0]); +} + +sub do_cmd_THEHOUR{ + local($_) = @_; + + join('', $global{HOUR}, $_[0]); +} + +sub do_cmd_THEMINUTE{ + local($_) = @_; + + join('', $global{MINUTE}, $_[0]); +} + +sub do_cmd_THESECOND{ + local($_) = @_; + + join('', $global{SECONDS}, $_[0]); +} + +sub do_cmd_THETOHOUR{ + local($_) = @_; + + join('', $global{TOHOUR}, $_[0]); +} + +sub do_cmd_THETOMINUTE{ + local($_) = @_; + + join('', $global{TOMINUTE}, $_[0]); +} + +sub do_cmd_THEHOURXII{ + local($_) = @_; + + join('', $global{HOURXII}, $_[0]); +} + +1; +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</datetime.perl> +% \end{macrocode} +%\fi %\Finale \endinput |