Time passed from a specific date

I would like to put in my resume

N years experience in Java

where N would be generated based on the date provided in the LaTeX file.

Preferably in rounded years, i.e. If the beginning date was 2012-06-04 and the output was generated on 2014-04-04, then the N would be 2.

-

A macro using the function defined in my answer to Day of the year

\documentclass{article}

\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\roundyears}{mmm}
{% #1 = year, #2 = month, #3 = day (beginning of experience
\fp_eval:n
{
floor (
( \juliandate_calc:nnnn { \day } { \month } { \year } { \use:n }
-
\juliandate_calc:nnnn { #3 } { #2 } { #1 } { \use:n } ) / 365
)
}
}

\cs_new:Npn \juliandate_calc:nnnn #1 #2 #3 #4 % #1 = day, #2 = month, #3 = year, #4 = what to do
{
#4
{
\int_eval:n
{
#1 +
\int_div_truncate:nn
{
153 * (#2 + 12 * \int_div_truncate:nn { 14 - #2 } { 12 } - 3) + 2
}
{ 5 } +
365 * (#3 + 4800 - \int_div_truncate:nn { 14 - #2 } { 12 } ) +
\int_div_truncate:nn { #3 + 4800 - \int_div_truncate:nn { 14 - #2 } { 12 } } { 4 } -
\int_div_truncate:nn { #3 + 4800 - \int_div_truncate:nn { 14 - #2 } { 12 } } { 100 } +
\int_div_truncate:nn { #3 + 4800 - \int_div_truncate:nn { 14 - #2 } { 12 } } { 400 } -
32045
}
}
}

\ExplSyntaxOff

\begin{document}

\roundyears{2011}{05}{06}

\roundyears{2012}{05}{03}

\roundyears{2012}{07}{12}

\end{document}


-