Formatting and inserting dates in LaTeX

How LaTeX inserts and formats dates with \today, \date, letters and custom ISO styles, plus when a typed date is the safer choice for sharing.

A date in a LaTeX document comes from one of two places. Either the compiler generates it when the document is built, or the author types it. That choice, plus the format you pick, decides whether the date stays accurate over time and whether readers in different regions interpret it the same way.

Short recommendation

Use \today for drafts, working notes and documents you rebuild often, where the date should mean "when this version was produced." Its main benefit is that it never goes stale while you are editing. The tradeoff is that it is recalculated on every compile, so it cannot record a fixed event. For letters, signed or submitted documents, published versions and anything where the date has legal or historical meaning, type the date yourself. When the audience is international, prefer a spelled-out month or the ISO year-month-day order over all-numeric formats with slashes.

Approach | What appears | Changes on recompile | Suited to
\today (default) | Compile date in the active language style | Yes | Drafts, frequently rebuilt documents
Typed date in \date{...} | Exactly the text you wrote | No | Letters, final versions, records
Empty \date{} | No date | Not applicable | Title pages that should carry no date
Custom macro or datetime2 style | Compile date in a chosen format, such as ISO | Yes, unless a fixed date is supplied | Consistent formatting across documents

What \today actually does

\today is a macro. When it is expanded during compilation, it produces text built from TeX's internal \year, \month and \day values, which are set from the system clock when the run starts. The source file therefore stores the command, not a date. The date exists only in the output, where it appears as ordinary text. This separation matters: the .tex file never records which date was printed, so two people compiling the same source on different days get different results.

\documentclass{article}
\begin{document}
This version was compiled on \today.
\end{document}

With no language package loaded, standard LaTeX prints \today in the American English month-day-year pattern with the month written out. Loading babel with another language or English variant changes the wording and order. For example, British English uses day-month-year order, and other languages use their own month names. Only the generated output text changes. The command in your source stays the same.

Restyling a date with commands such as \textit or \textsc selects a different font. It does not substitute Unicode look-alike characters, so the underlying text is still normal letters and digits. How faithfully that text survives extraction from a PDF still depends on the font and engine used.

Dates in the title block

In the standard article, report and book classes, \maketitle prints the compile date if you never call \date. Passing an empty argument suppresses the date entirely. Passing any text fixes it, and that text does not have to be a calendar date.

\title{Project Report}
\author{A. Author}
\date{}                 % no date on the title
% \date{\today}         % compile date (same as the default)
% \date{Final version}  % any fixed text
\begin{document}
\maketitle
\end{document}

Dates in letters

The standard letter class prints a date near the top of each letter, and that date defaults to \today. A letter is a record of when it was written, so set the date explicitly with \date. Otherwise, reopening and recompiling the file later silently changes the letter's date.

\documentclass{letter}
\signature{A. Author}
\address{Sender address line}
\date{Type the letter's date here}
\begin{document}
\begin{letter}{Recipient name \\ Recipient address}
\opening{Dear Recipient,}
Body of the letter.
\closing{Sincerely,}
\end{letter}
\end{document}

Custom and ISO formats

You can build any format from the date counters without loading a package. The macro below pads the month and day to two digits to produce the ISO year-month-day order. Readers across regions interpret that order the same way, and it sorts correctly as text.

\newcommand{\isodate}{%
  \the\year-%
  \ifnum\month<10 0\fi\the\month-%
  \ifnum\day<10 0\fi\the\day}

Compiled on \isodate.

For more control, the datetime2 package provides named date styles and optional language modules, and it routes \today through the selected style. Its built-in ISO style is shown below. Style names beyond the built-in ones depend on which modules are installed, so check the package documentation in your distribution.

\usepackage{datetime2}
\DTMsetdatestyle{iso}
...
\today

Using these on Overleaf

Overleaf compiles projects with a standard TeX distribution, so the commands above work there unchanged. Because compilation happens on Overleaf's servers, \today reflects the server's clock at the moment of each compile, and automatic recompiles update it too. This review could not verify whether that clock's time zone matches yours. If you compile near midnight, check the printed date before you share the PDF, or type the date to remove the question.

Readability after copying or sharing

  • Copy and paste: a rendered date is text in the PDF and normally copies as text. Superscript ordinals or unusual fonts may extract differently. No specific PDF viewers were tested for this review.
  • Ambiguity: all-numeric dates with slashes are read month-first in the US and day-first in many other regions. A spelled-out month or ISO order avoids misreading.
  • Assistive technology: screen readers read the date as it appears in the PDF text, and how they announce numeric formats can vary. Spelled-out months are the least ambiguous choice. No scoped screen reader test was supplied, and whether the PDF is properly tagged for accessibility is a separate matter from date formatting.
  • Search: PDF search matches the characters actually printed, so a reader searching for one date format will not find a date printed in another.
  • Editing and archiving: the source contains \today, not the date. Anyone who recompiles it gets a new date. Keep the produced PDF, or replace \today with typed text, when the date must be preserved.
  • Reproducible builds: TeX Live engines can take their date from the SOURCE_DATE_EPOCH environment variable when it is set and forced, which pins \today across builds. Confirm the behavior for your engine and version before relying on it.

Evidence gaps

This review is based on the documented behavior of the standard LaTeX classes, babel and datetime2. It does not include tests of particular PDF viewers, screen readers or Overleaf's server time zone. Before treating the output as final, check the printed date and its copy-and-paste behavior in the environment where your readers will open the document.