Month/Year Format in Latex

You can use the datetime package to customize the formatting; a little complete example:

\documentclass{book}
\usepackage{datetime}

\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH], \THEYEAR}

\begin{document}

\monthyeardate\today

\end{document}

produces

enter image description here


With datetime2 package, there is at least two ways to achieve this. The first is a bit similar to the answer by Gonzalo:

\documentclass[english]{book}
\usepackage{datetime2}

\makeatletter
\newcommand{\monthyeardate}{%
  \DTMenglishmonthname{\@dtm@month}, \@dtm@year
}
\makeatother

\begin{document}

\monthyeardate

\end{document}

datetime2 the first way

The other way, I think, is more LaTeXian:

\documentclass{book}
\usepackage[en-US]{datetime2}

\begin{document}

\today

\DTMlangsetup{showdayofmonth=false}
\today
\DTMlangsetup{showdayofmonth=true}

\today

\end{document}

datetime2 the second way

Some notes:

  • For the first way to work, english parameter for \documentclass seems to be required. Alternatively, english can be omitted and en-US or en-GB given for datetime2 as \usepackage[en-US]{datetime2}
  • The second way requires en-US or en-GB even when english has been given for \documentclass.
  • The ways were tested with pdflatex, version pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015).

More details are provided in:

  • datetime2 documentation
  • datetime2-english documentation

A simple solution that requires no extra packages is the following:

\documentclass{article}

\renewcommand{\today}{\ifcase \month \or January\or February\or March\or %
April\or May \or June\or July\or August\or September\or October\or November\or %
December\fi, \number \year} 

\begin{document}
\today
\end{document}

The result:

Tags:

Datetime