# Using calc and \year to get the years from a start date automatically in text?

I would like to say, "I have played piano for 23 years" -- but this document will have to be changed every year so I remember to make it 23, then 24, then 25. Is there a way to do something like:

I have played piano for \calculate{\year - 1986} years.


Perhaps using the calc package and the \year command? I haven't been able to figure this out.

-
–  Claudio Fiandrino Feb 3 '13 at 14:19

You can use the integer arithmetic of TeX too.

\documentclass{article}
\begin{document}
I've played the piano for \number\numexpr\year-1986\relax~years.
\end{document}

-
Just in case you are going to use tikz in your document, here is an overkill solution with this package.
\documentclass{article}