summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/weekday.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/weekday.sty')
-rw-r--r--Master/texmf-dist/tex/generic/genmisc/weekday.sty74
1 files changed, 74 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/weekday.sty b/Master/texmf-dist/tex/generic/genmisc/weekday.sty
new file mode 100644
index 00000000000..cda185ad31b
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/genmisc/weekday.sty
@@ -0,0 +1,74 @@
+% Save file as: WEEKDAY.STY Source: FILESERV@SHSU.BITNET
+%% WEEKDAY.STY -- original source: Dimitri Vulis <DLV@CUNYVMS1.BITNET> with
+%% modifications by George D. Greenwade <BED_GDG@SHSU.BITNET>, and gracious
+%% assistance from Bernhard Schroeder <UPK002@DBNRHRZ1.BITNET>, Hunter
+%% Goatley <GOATHUNTER@WKUVX1.BITNET>, and others via INFO-TeX/comp.text.tex.
+%% 21-FEB-1991 17:42:37
+%%
+%% Usage: \weekday{yyyy}{mm}{dd} (where "yyyy" is a year, "mm" is the numeric
+%% equilavent of the month, and "dd" is the specific calendar date
+%% which may be one or two numbers) yields the weekday associated with
+%% the date provided (i.e., Sunday, Monday, ...). May pass \year,
+%% \month, and \day to generate today's weekday.
+%%
+%% -- \weekdaydate{yyyy}{mm}{dd} yields result of \weekday, as well as the
+%% calendar date (i.e., \weekdaydate{1991}{02}{21} yields Thursday,
+%% February 21, 1991). (NOTE: syntax is changed from \weekdaydisplay
+%% to \weekdaydate to make it a little more rememberable)
+%%
+%% May be used as a TeX macro or as a LaTeX style, from what I can tell.
+%% Please report any enhancements or bugs you come across so they can be
+%% posted in FILESERV's STYle archives. George <BED_GDG@SHSU.BITNET>
+%%
+\newcount\wwwy
+\newcount\wwwm
+\newcount\wwwd
+\newcount\wwwc
+\newcount\wwwt
+\newcount\wwws
+
+\def\weekday@{%
+\wwwc=\wwwy
+\divide\wwwc100\relax
+\wwwt=-\wwwc
+\multiply\wwwt100\relax
+\advance\wwwy\wwwt
+\wwws=\wwwy
+\multiply\wwws1461\relax
+\divide\wwws4\relax
+\wwwt=\wwwm
+\multiply\wwwt764\relax
+\divide\wwwt25\relax
+\advance\wwws\wwwt
+\advance\wwws\wwwd
+\ifnum\wwwm>\tw@\advance\wwws\thr@@\else\weekday@@\fi
+\wwwt=-\wwws
+\divide\wwwt7\relax
+\multiply\wwwt7\relax
+\advance\wwws\wwwt
+}
+
+% By the year 2000 we ought to examine \wwwc as well
+
+\def\weekday@@{%
+\wwwt=\wwwy
+\divide\wwwt4\relax
+\multiply\wwwt4\relax
+\advance\wwwt-\wwwy
+\ifnum\wwwt=\z@\advance\wwws4\else\advance\wwws5\fi
+}
+
+\def\weekday#1#2#3{% year, month 1--12, day 1--31
+\wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax \weekday@
+\ifcase\wwws Sunday\or
+ Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\fi}
+
+\def\weekdaydate#1#2#3{% year, month 1--12, day 1--31
+\wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax\weekday@
+\ifcase\wwws Sunday,\or
+Monday,\or Tuesday,\or Wednesday,\or Thursday,\or Friday,\or Saturday,\fi
+\space
+\ifcase #2\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+\space\number#3, \space\number#1} % Here I (Bernhard) inserted \number