Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The best I've been able to do is with isodate. It's the only package I've been able to find that works on arbitrary dates.

\usepackage[orig, british, cleanlook]{isodate}
\printdate{2013-06-28}

produces:

28 June 2013

I'm looking to have the month abbreviated to match our existing documentation format. I would like to end up with:

28 Jun 2013

Where all the months are abreviated. I'm thinking maybe I need to make a custom language for isodate, but there must be a better way.

Update:

I have also looked at the datetime package's \formatdate command. Unfortunately the date comes in as a solid string and I don't have the option of splitting it to the separate fields that the command needs.

I would be satisfied with something along the lines of:

\formatdate{\getday{2013-06-28}}{\getmonth{2013-06-28}}{\getyear{2013-06-28}}

That could be defined to a new command that would be easier to use.

share|improve this question
    
Welcome to TeX.SX! –  Papiro Jun 29 '13 at 1:10
add comment

1 Answer

up vote 5 down vote accepted

You can update the English month lookup to suit your needs:

enter image description here

\documentclass{article}
\usepackage[orig, british, cleanlook]{isodate}% http://ctan.org/pkg/isodate
\begin{document}

\printdate{2013-06-28}% Old date format

\makeatletter
% Update English month lookup
\def\month@english{\ifcase\month\or
    Jan\or Feb\or Mar\or Apr\or May\or Jun\or
    Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}
\makeatother

\printdate{2013-06-28}% New date format

\end{document}

The above suggests a global change to the English month lookup. If you want a more localized version, you could include the following in your document preamble:

\makeatletter
\def\short@month@english{\ifcase\month\or
    Jan\or Feb\or Mar\or Apr\or May\or Jun\or
    Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}
\newcommand{\printshortdate}[1]{{%
  \let\month@english\short@month@english% Update English month lookup (locally)
  \printdate{#1}}}% Call traditional \printdate
\makeatother

which allows you to use \printdate and/or \printshortdate interchangably. \printshortdate updates \month@english temporarily (note the nested braces {..}) before calling the traditional \printdate macro.

share|improve this answer
    
Awesome, Thanks! Just started with LaTeX last week, it's a very deep hole. –  Gavin S Jun 29 '13 at 1:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.