# Custom date format

I am trying to create a fancy date format as shown below:

The following is a MWE of what I have so far. For some reason or the other I can't seem to get the right height.

\documentclass[letterpaper]{article}
\usepackage{graphicx}
\usepackage{datetime}
\usepackage{calc}

\newlength{\dateboxheight}
\setlength{\dateboxheight}{%
\heightof{%
\parbox[b]{3em}{%
May\\ %
2014%
}
}
}
\newdateformat{squaredate}{%
\mbox{%
\resizebox{\dateboxheight}{!}{\THEDAY}~%
\parbox[b]{3em}{%
\monthname[\THEMONTH]\\ %
\THEYEAR%
}}}

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


Any suggestions or improvements are welcomed. I know this can be done in TikZ; hence, I would consider it as a possible solution. Other improvement that are welcomed could be that the other months, like November, could be abbreviated so that they have the same width of May; that is, Nov. Probably an \ifelse case?

You are providing the incorrect height/width sizing in \resizebox. This is the appropriate interface: \resizebox{<width>}{<height>}{<stuff>}, so you should use

%...
\resizebox{!}{\dateboxheight}{\THEDAY}~%
%...


Here is something else to work with:

\documentclass{article}
\usepackage{graphicx,datetime}
\usepackage[table]{xcolor}

\colorlet{datecolor}{black!40}
\colorlet{datebackground}{black!10}

\newdateformat{squaredate}{{%
\renewcommand{\arraystretch}{1.2}%
\begin{tabular}{rl}
\cellcolor{datebackground} & \cellcolor{datebackground}\color{datecolor}\monthname[\THEMONTH] \\ %
\cellcolor{datebackground}\smash{\color{datecolor}\resizebox{2.5\normalbaselineskip}{!}{\sffamily\THEDAY}} &
\cellcolor{datebackground}\color{datecolor}\THEYEAR
\end{tabular}
}}

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

• How silly of me :-) I guess I was tired last night I didn't realize it. Thanks for the reminder. – azetina May 22 '14 at 0:31

I think this will do it. I have used tikz to achieve the goal. Here is the code:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{anyfontsize}

\newcommand{\squaredate}[3]{%
\begin{tikzpicture}
\filldraw[color=lightgray] (-.1,-7) rectangle (-4.5,-5);
\draw (-3.5,-6) node {\fontsize{50}{60}\selectfont\bfseries  #1}; %%the two arguments to \fontsize are the actual font size and the size of the baseline-skip. The baseline-skip should be set to roughly 1.2x the font size.
\draw (-1.3,-5.5) node {\LARGE\bfseries #2};
\draw (-2.5,-6) -- (-0.2,-6);
\draw (-1.4,-6.5) node {\LARGE\bfseries #3};
\end{tikzpicture}
}%

\begin{document}
\squaredate{20}{May}{2014}
\end{document}


I have defined a new command squaredate. It takes 3 arguments. The date, month and the year. And displays as per requirement.

Here is the output: