🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10177

Re: \age in years solved

#10177
From: Eric Olson
Date: Sun, 09 Jun 1991 21:45
38 lines
1809 bytes
In article <1991Jun7.194112.7886@cs.utk.edu> woo@ornl.gov (John W. Wooten) writes:
>This \age{mm/dd/yy} gives # of years between today and mm/dd/yy.
>If dates before 1900 needed then comment out line with 1900 and
>use \age{mm/dd/yyyy}.

It seems to me that it's much easier just to stick an extra if in, and
if (yy/yyyy) is less than 100, treat it as an after 1900 date:

I just like it better that way because I'm terrible at remembering
what little tricks and fixes that macro there requires after a month
or two.
----
%
\catcode`@=11
\newcount\@tempnuma
\def\@null{null}
\def\age#1{\@age#1\@null}
\def\@age#1/#2/#3\@null{%
        \@tempnuma\year
	\ifnum#1<100
		\advance\@tempnuma by -1900
	\fi
        \advance\@tempnuma by -#3\relax  % gives # of years 
        %\number\@tempnuma
	\ifnum#1 > \month	%anniv month is later in year
			\advance\@tempnuma by -1\relax
	\else
			\ifnum#1 = \month	%anniv month is this month
				\ifnum#2 > \day	%anniv day is later in month
					\advance\@tempnuma by -1\relax
				\fi\relax
			\fi\relax
	\fi\relax
    \number\@tempnuma}
\catcode`@=12
%

Eric Olson <ejo@ims.alaska.edu>
Technical Details
Message-ID: <1991Jun9.204540.27119@ims.alaska.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ames!bionet!raven.alaska.edu!hayes.ims.alaska.edu!hayes!ejo
References: <1991Jun7.194112.7886@cs.utk.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ames!bionet!raven.alaska.edu!hayes.ims.alaska.edu!hayes!ejo
From: ejo@ims.alaska.edu (Eric Olson)
Newsgroups: comp.text.tex
Subject: Re: \age in years solved
Message-ID: <1991Jun9.204540.27119@ims.alaska.edu>
Date: 9 Jun 91 21:45:35 GMT
References: <1991Jun7.194112.7886@cs.utk.edu>
Sender: usenet@ims.alaska.edu (J Random USENET)
Organization: Citizens for Boysenberry Jam Fans
Lines: 38
In-Reply-To: woo@ornl.gov's message of 7 Jun 91 19: 41:12 GMT
Nntp-Posting-Host: hayes.ims.alaska.edu