Calculate Age Automatically in LaTEX Document

Source

I use this to minimize the effort in updating my CV.

 

\documentclass{article}

...

\usepackage{datenumber, fp}
\newcounter{birthday}
\newcounter{today}
\setmydatenumber{birthday}{1988}{02}{29}
\setmydatenumber{today}{\the\year}{\the\month}{\the\day}
\FPsub\result{\thetoday}{\thebirthday}
\FPdiv\myage{\result}{365.2425}
\FPround\myage{\myage}{0}

...

\begin{document}

Hello, I am \myage years old.

\end{document}
Advertisements