I want to have a command to display the current time in a few different formats, specifically, the following:

  • 2015-05-15
  • 15 May 2015
  • 122200
  • 2015-05-15T122200

I'm not sure how to do this properly in LaTeX. I attempted the following:

\documentclass[american, a4paper]{report}

% time
% ISO date
    \usepackage[iso, inputamerican]{isodate}
% date formatting
        \THEDAY~\monthname[\THEMONTH] \THEYEAR


\item \timeA\today
\item \timeB\today
\item \timeC\today
\item \timeD\today


What I get when I compile this is the following:

  • 2015-05-15
  • 2015-05-15
  • 1222002015-05-15
  • 2015-05-15

What should I change? Is there a better way to approach this?

Following a suggestion by @Grimler, I removed the package isodate. This is a step in the right direction and produces the following result:

  • 2015-05-15
  • 15 May 2015
  • 122200 15 May 2015
  • 2015-05-15T 122200

So, what it would be good to know now is how to print the third one correctly (i.e. without the date) -- should simply setting the format actually print something? -- and how to remove the space between the T and the time in the fourth one.

  • 2
    FYI: package datetime got obsolete a little while back and the moden package datetime2 can be used. – Johannes_B May 15 '15 at 12:36
  • 1
    Removing the isodate package gives the result you want. I guess the two packages don't play well together. – Grimler May 15 '15 at 12:37
  • @Johannes_B Thanks for that. I'll give it a try. Would you happen to know how to install this in Ubuntu 15.04? – d3pd May 15 '15 at 12:50
  • @Grimler Thanks for that. It's certainly a step in the right direction. It doesn't produce exactly the correct output -- I've detailed this in the edit above. If you have any ideas about how to think about how the formatting step is printing something and if you have any ideas about how to remove that space between the T and the time, please let me know. – d3pd May 15 '15 at 12:52

I don't really understand why, but if you remove the \today on the third itemize row, you get rid of the date but keep the time (\item \timeC instead of \item \timeC\today)

As for the space after the T, simply change the \timeC definition to:

  • Great, thank you very much for your assistance. – d3pd Jun 1 '15 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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