[Tex/LaTex] Day of the year

calculationsdatetime

I'm using the day of the year a lot in my documents and I wonder if I can have LaTex calculating it for me? Example: 2013178 where 2013 is (surprise) the current year (which I know could be achieved by \the\year) and 178, the day of the year.

Was googling both in english and in german ("LaTex day of the year" and "Latex Tag des Jahres") and found only posts and howtos regarding the day of the week and month.

PS: I tagged it with macros since I assume that this might need one to be solved.

Best Answer

Why not the simpler way of datenumber?

MWE

\documentclass{article}
\usepackage{xcolor}         % to distinguish coupled numbers 
\usepackage{datenumber}
\setdate{2013}{6}{27}       % date of the OP
\setstartyear{\thedateyear} % count days from here


\begin{document}

The \datedate{} was  \thedateyear{\color{red!80!black}\thedatenumber} \\

Today (\today) \setdatetoday is \thedateyear{\color{blue}\thedatenumber}

\end{document}
Related Question