Custom Date Package
Here's the code for mycustomdate.sty:\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mycustomdate}[2014/03/19 1.0 My custom date format] \RequirePackage{etoolbox}% \RequirePackage{pgfkeys,pgfcalendar} % Define an ordinal command: \newcommand*{\ord}[1]{% \number#1% \ifcase#1\or st\or nd\or rd\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or th\or st\or nd\or rd\or th\or th\or th\or th\or th\or th\or th\or st\fi } % Define registers needed by \printdate: \newcount\julianday \newcount\dayofweek % Define generic date format: \newcommand*{\datefmt}[4][]{% \ifstrempty{#1} {}% day of week missing {% \pgfcalendarweekdayname{#1}\space }% \ord{#4}~\pgfcalendarmonthname{#3} \number#2% } % Define command to convert ISO date to a form that can be used by \datefmt: \newcommand*{\printdate}[1]{% \pgfcalendardatetojulian{#1}{\julianday}% \pgfcalendarjuliantodate{\julianday}{\thisyear}{\thismonth}{\thisday}% \pgfcalendarjuliantoweekday{\julianday}{\dayofweek}% % Now display the date: \datefmt[\dayofweek]{\thisyear}{\thismonth}{\thisday}% } % Redefine \today to use the same format: \renewcommand*{\today}{% \pgfcalendardatetojulian{\year-\month-\day}{\julianday}% \pgfcalendarjuliantoweekday{\julianday}{\dayofweek}% \datefmt[\dayofweek]{\year}{\month}{\day}% } % Check if babel is used with the british option: \AtBeginDocument{% \ifdef{\datebritish}% check if \datebritish exists {% it does exist, so redefine it \renewcommand*{\datebritish}{% \renewcommand*{\today}{% \pgfcalendardatetojulian{\year-\month-\day}{\julianday}% \pgfcalendarjuliantoweekday{\julianday}{\dayofweek}% \datefmt[\dayofweek]{\year}{\month}{\day}% }% }% }% {}% doesn't exist, do nothing } \endinputAnd here's the code for the sample document:
\documentclass{article} \usepackage{mycustomdate} \begin{document} Today: \today. Tomorrow: \printdate{\year-\month-\day+1}. Yesterday: \printdate{\year-\month-\day+-1}. The first day of this month: \printdate{\year-\month-1}. The last day of this month: \printdate{\year-\month-last}. A specific date: \printdate{2014-3-20}. A date without the day of week: \datefmt{2014}{3}{20}. \end{document}
Download customprintdate.tex or customprintdate.pdf.