I need to process a latex command if and only if the current date is between certain months, say between april 15 and june 15 of any given year. I imagine it's possible with datetime.sty but all the examples on the web seem to involve relative dates (i.e., the date relative to the current day) rather than absolute dates. Also I want the conditioning event to depend only on the day and month and not on the year. Is this possible? Thanks very much.
I've added my own answer, which is not elegant, but works. I didn't want to put it into a comment for obvious reasons.
\documentclass{minimal}
\usepackage{datenumber}
%#1-#2 is start month-day
%#3-#4 is end month-day
%#5: do this if within the range
%#6 do this if outside the range
\newcounter{doIt}
\newcommand{\doInDateRange}[6]{
\setcounter{doIt}{0}
\ifnum\thedatemonth>#1
\ifnum\thedateday>#2
\setcounter{doIt}{1}
\fi
\fi
\ifnum\thedatemonth<#3
\ifnum\thedateday<#4
\addtocounter{doIt}{1}
\fi
\fi
\ifnum\value{doIt}=2
#5
\else
#6
\fi
}
\begin{document}
\doInDateRange{3}{20}{5}{22}{Your are within the date range}{You are outside the date range}\\
\doInDateRange{3}{22}{12}{31}{Your are within the date range}{You are outside the date range}\\
\doInDateRange{1}{1}{5}{22}{Your are within the date range}{You are outside the date range}
\end{document}
datetime2-calc– Sean Allred Apr 21 '16 at 03:05\dayand\month, both integers, so this is all doable. – Joseph Wright Apr 21 '16 at 06:04