I would like to be able to use, in the same document, these two date formats:
- dd/mm/yyyy (as default format)
- yymmdd (as "local" format)
Why I want that?
Because I would like to use the "local" format to define the document reference code (e.g. mydocumenttitle_yymmdd.pdf
) but in "normal" text, I would like to use the default dd/mm/yyyy
format with the command \today
.
First attempt
For the moment I wasn't able to do better than this:
\documentclass{article}
\usepackage{datetime}
\newdate{specialdate}{\day}{\month}{\year}
\usepackage[datesep={}]{datetime2}
\begin{document}
Format with dd/mm/yyyy: {\ddmmyyyydate\displaydate{specialdate}}
Format with yymmdd: \today
\end{document}
Which gives the following result:
But there are the following problems:
The
yymmdd
format is not correct because I achieve onlyyyyymmdd
. How to obtain the date format with only two digits for the year:yymmdd
?The use of command
\today
doens't give the default format but theyymmdd
one. Is there a way to define\today
with the default format (i.e.dd/mm/yyyy
) and another command for the "local" format (i.e.yymmdd
)?It use the two packages
datetime
anddatetime2
. Is it possible to use only one package?
\today
), it may mess up some packages.\today
. About your fisrt comment, imho, limiting the number of packages helps prevent future package incompatibilities. When working on large documents with lots of packages it can also make a major difference in terms of readability. But here my concern was not to limit the number of packages but I thought that if there was adatetime2
it was perhaps to replace thedatetime
package... I should have specified that in my question sorry.