18

I am writing a report in which i need to write date and time in the footer. How do I write date and time in footer?

like

      Jan 8, 2013 5:45 PM
  • 1
    Thanks for accepting my answer, I'm glad it was helpful. Looking at your profile, I see that you have asked 31 questions, but you have never cast a single up-vote. Up-voting is the currency of the site, and you should try to up-vote any answers that you find helpful- please see tex.stackexchange.com/faq#howtoask for further information. – cmhughes Jan 11 '13 at 16:37
17

You can use the fancyhdr and datetime package to help with this, as demonstrated in the following MWE.

Note that \today is actually defined in LaTeX (no extra packages needed), but you need datetime for \currenttime

\documentclass{article}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{datetime}

\fancyhf{}
\fancyfoot[L]{\today\ \currenttime}
\pagestyle{fancy}

\begin{document}

\lipsum

\end{document}

This generates the following footer.

screenshot of generated PDF

The fancyhf command clears the header and the footer, and the fancyfoot command does the specific part of your question. Setting the pagestyle as fancy seals the deal.

  • 3
    Note: datetime is considered obsolete and replaced with datetime2. – Joel Aug 8 '16 at 10:11
  • This put a horizontal rule in my header, so I added \renewcommand{\headrulewidth}{0.0pt} to remove it. – Gabriel C. Drummond-Cole Jan 18 '18 at 5:44

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.