🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10154

\age in years solved

#10154
From: John W. Wooten
Date: Fri, 07 Jun 1991 19:41
39 lines
1639 bytes
Found a way to keep resumes and other documents that include statements
like in the past xx years, etc.   Updated.

(Thanks to dmjones@theory.lcs.mit.edu (David M. Jones) for getting me
started on the solution. )

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}.

----
%
\catcode`@=11
\newcount\@tempnuma
\def\@null{null}
\def\age#1{\@age#1\@null}
\def\@age#1/#2/#3\@null{%
        \@tempnuma\year
        \advance\@tempnuma by -1900 % Comment this line out for dates of
                                    % the form 2/24/1967 - last 2 digits of yr.
        \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
%
Test cases  
\age{5/6/84}, \age{5/7/84}, \age{5/8/84},
\age{6/6/84}, \age{6/7/84}, \age{6/8/84},
\age{7/6/84}, \age{7/7/84}, \age{7/8/84}.
%
Technical Details
Message-ID: <1991Jun7.194112.7886@cs.utk.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!utkcs2!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!utkcs2!usenet
From: woo@ornl.gov (John W. Wooten)
Newsgroups: comp.text.tex
Subject: \age in years solved
Message-ID: <1991Jun7.194112.7886@cs.utk.edu>
Date: 7 Jun 91 19:41:12 GMT
Sender: usenet@cs.utk.edu (USENET News Poster)
Organization: Univ of TN, Knoxville - CS Department
Lines: 39