The datetime2 package has replaced the now obsolete datetime package. This section is just a brief introduction, see the user guide  for other commands and settings not described here.
The simplest use of this package is:
This is the default date format. If you want the full date, time and time zone, you can use
\today. This will display the date and time in the form
Note that XeLaTeX doesn't provide the time zone information so you will need to use PDFLaTeX or LuaLaTeX if you want this.
If you want to use a regional format, you can specify the region in the package option. For example:
If you prefer a numeric regional format you can use
showdowpackage option, but this isn't available for all regions. You will need to check the documentation for the relevant module to find out if it's supported.
If you want to display a particular date (without the time) in the current style you can use
where ⟨date⟩ is given in the format ⟨yyyy⟩-⟨mm⟩-⟨dd⟩. For example:
You can save a date and time for later use with:
where ⟨name⟩ is a unique label that identifies this date and time, and ⟨data⟩ is in the format
where ⟨YYYY⟩ is the year, ⟨MM⟩ is the month number, ⟨DD⟩ is the day of the month, ⟨hh⟩ is the hour (24), ⟨mm⟩ is the minute value, ⟨ss⟩ is the second value and ⟨zone⟩ is the time zone, which may be either Z or in the format ⟨TZh⟩:⟨TZm⟩ where ⟨TZh⟩ is the hour offset and ⟨TZm⟩ is the minute offset. The argument ⟨data⟩ may also be a control sequence that expands (one level) to the required format.
Alternatively, you can just save the date with:
where the ⟨date⟩ is in the format ⟨YYYY⟩-⟨DD⟩-⟨MM⟩ and ⟨name⟩ is again a label.
A previously saved date and time can be displayed in the current style using:
Just the date can be displayed using:
and just the time with:
In all cases, ⟨name⟩ is the label identifying the date or time stamp.
Here's an example that uses the
\DTMsavetimestampto fail. You may need to temporarily switch off the shorthands. See the babel manual  for further details.
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).