2022 Developer Survey is open! Take survey.

Questions tagged [datetime2]

The `datetime2` package provides commands for formatting dates, times and time zones and redefines `\today` to use the same formatting style.

Filter by
Sorted by
Tagged with
6 votes
2 answers
212 views

How to Extract the Three First Letters of Current Month in French without Accented Characters?

Is there a way to extract the 3 first letters of the current month in French but WITHOUT acented characters AND with the first letter capitalized - e.g. Fev for Février (February in english) - AND ...
user avatar
2 votes
1 answer
45 views

How to use two different date formats: yymmdd and dd/mm/yyyy?

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 &...
user avatar
4 votes
1 answer
47 views

datetime2 causes stack error

Anyone able to explain why this is? Here's a mwe. If I comment out the two datetime2 lines, document compiles fine, otherwise failure occurs on \opening: \documentclass[a4paper, margin=2cm, ...
user avatar
  • 75
1 vote
1 answer
37 views

How to display only the year and month with datetime2?

With the \DTMdisplaydate{yyyy}{mm}{dd}{w} provided in datetime2, one can easily display a specific date. However, one cannot use it directly to display only the year and month, since the third ...
user avatar
  • 4,849
0 votes
0 answers
38 views

Package datetime2-calc Warning: Can't find underlying language macro for

I'm trying to print the month and year using the datetime2 package; here is a minimal example: \documentclass[12pt]{article} \usepackage[nynorsk]{babel} \usepackage[useregional,calc]{datetime2} \...
user avatar
  • 1
2 votes
1 answer
37 views

Using advdate and datetime2

I would like to combine the advdate package for relative dates and the datetime2 package for custom formatting. However, the datetime2 package seems to undo whatever advdate does. I've only found ...
user avatar
  • 698
2 votes
3 answers
142 views

How can I extract a date from a file named YYYYMMDD.tex and convert it to date string?

I have a .tex file which is named 20160201.tex, and within that file, I would like to extract the filename without .tex and convert it to the string February 01, 2016? I am able to get the string via ...
user avatar
  • 31
0 votes
0 answers
71 views

Use command once only

Let me straight to the idea: I want to create a customed document format for diary and journal writting purpose. The ideas is pretty simple, one of them is: I will create a note command that will ...
user avatar
2 votes
1 answer
58 views

Store \today value with \DTMsavedate

Goal With datetime2 package I try to save the “\today” date with \DTMdatesave command, but it successively fail. My tries 1. The dumb method I began with the most evident way. Putting directly \today ...
user avatar
  • 2,080
5 votes
2 answers
99 views

Hebrew date without day of month using polyglossia

I'd like to typeset today's month and year, where "today" is determined automatically. However, I'd like to do so using polyglossia's Hebrew locale. I've tried to adapt this answer as ...
user avatar
  • 8,684
0 votes
2 answers
88 views

Offset section currenttime by hours

I want to change timezone in a section of a document. An hour offset from server time would suffice. Using package datetime, how do I add or subtract hours from date \today? Using advdate and datetime ...
user avatar
2 votes
1 answer
96 views

Changed hyperxmp or hyperref causing error with pdfdate={\today}

The following used to be OK. With the most recent release of hyperxmp, it no longer does, giving error: ./hypersetup-bug.tex:9: Argument of \hyxmp@pdf@to@xmp@date has an extra }. <inserted text> ...
user avatar
  • 6,382
6 votes
1 answer
310 views

Abbreviations of Weeknames in German

This is pretty straight-forward. I have finally managed to abbreviate weeknames in “British”, i.e. en-GB. (What I need is ngerman) But, as I'm working on a German document, I need the date format ...
user avatar
  • 128
2 votes
1 answer
57 views

typesetting \today in local numeric and textual form

The datetime2 docs are hard to read. I just want to typeset \today's date, both numerically and textually, in the correct way, depending on the babel language setting. Here is my MWE: \documentclass{...
user avatar
  • 50.9k
9 votes
1 answer
545 views

A professional stamp in relief

Related to these previous my questions A special annulment (i.e., cancellation) of a stamp and Date time in two rows in Italian format and time zone I have created another MWE to have some different ...
user avatar
  • 46.2k
4 votes
1 answer
169 views

Date time in two rows in Italian format and time zone

I have now created this MWE: \documentclass[12pt,margin=3mm]{standalone} \usepackage{newtxtext} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usepackage{datetime2} \usepackage{fontawesome5} \...
user avatar
  • 46.2k
-1 votes
1 answer
63 views

Get HH:MM:SS from datetime2 by giving seconds [duplicate]

I search a command that give formated time like HH:MM:SS when I give just seconds. As example, if the search command is \formatetime{}, it should give the following result: \formatetime{50} % should ...
user avatar
  • 2,080
4 votes
2 answers
174 views

Date without year

I would like the dates language within a document controlled by package. It seems that datetime2 is the only contemporary package doing this stuff. However, occasionally I need only to display day ...
user avatar
  • 5,473
2 votes
1 answer
145 views

Localization for \date command

How can I apply localization for the \date command? For now it seems to just display an arbitrary string. \documentclass{article} \author{me} \date{bla bla bla} \begin{document} \maketitle \end{...
user avatar
1 vote
1 answer
97 views

Add days to a specific date in datetime2 in a for loop / foreach loop

I want to calculate the beginning and ending date of a week (first day is Monday, last is Sunday). This is working fine for a single date. Now I want to calculate the start and end of multiple weeks ...
user avatar
0 votes
1 answer
72 views

datetime2: future dates in a specific (ad hoc) format

I've seen these posts ... Changing date format in datetime2 latex date calculations with datetime2 and ddmm format ... and in theory I ought to be knowing what to do, yet... I am not. Instead... I'm ...
user avatar
  • 1
0 votes
1 answer
47 views

How could work `\spanishdatedel` with datetime2 package

I'm asking if is possible to use \spanishdatedel commmand of babel-spanish package. \documentclass{article} \usepackage[english,spanish]{babel} \spanishdatedel \usepackage{datetime2} \DTMsetup{...
user avatar
  • 359
4 votes
1 answer
176 views

How can I convert a datetime month name to uppercase?

I'm trying to create a date style that results in 01 JUN 2020 \documentclass{article} \usepackage[USenglish]{babel} \usepackage[showseconds=false,useregional=text,calc]{datetime2} \...
user avatar
  • 43
0 votes
1 answer
97 views

datetime2 - Display Daterange

Is it possible to display a daterange with datetime2 like in isodate? isodate automatically calculates the correct difference and displays the correct range. However, datetime2 has the correct display....
user avatar
  • 2,680
0 votes
0 answers
98 views

Make documents where the date printed on the document is automatically the date of creation of document

Is there a way to create latex documents where the date printed on the documents is always by default the date of creation of the document? I don't want to compile the same latex file 30 days later ...
user avatar
4 votes
1 answer
162 views

Warning: Date-Time Language Module `nynorsk' not installed

I am working through the warnings and errors of a project of mine. One error that has been bugging me is in regards to the datetime2 package. The following code \documentclass[margin=1mm]{standalone}...
user avatar
2 votes
1 answer
55 views

"Hidden text" inflates `widthof`

French letters call for a heading stating place and date, which I put in \letterlieudate, which I put in a minipage. Requirement: that the minipage's width be just big enough so that \letterlieudate ...
user avatar
  • 1,868
5 votes
2 answers
180 views

Command \nr already defined (datetime2 and nccmath incompatibility)

It seems that the datetime2 and the nccmath packages are incompatible when I load the [useregional] option in the first (I get command \nr already defined). I used a solution for reducing spacing ...
user avatar
2 votes
1 answer
275 views

Change date style when using regional settings in datetime2

I can't seem to change datetime2's settings when using the option useregional to display the date in the language given to babel \documentclass{article} \usepackage[T1]{fontenc} \usepackage[italian]{...
user avatar
  • 1,994
6 votes
1 answer
304 views

Extract year, month, day from datetime2

I have made a command that looks like this: \newcommand*{\numdash}{\,--\,} \ExplSyntaxOn \NewDocumentCommand{\dateRange}{mmmmmm} { \str_case:nnF { #1 } { {#4} { ...
user avatar
1 vote
1 answer
89 views

Using the datetime2 package, how do we individually retrieve each of yyyy, yy, mm, dd, mmm, ddd, hhmm, hhmmss, etc.?

Let's say it's now 2019-07-21-082935. If I'm using the datetime2 package, what commands do I use to individually retrieve each of "2019", "19", "07", "7", "JUL", "July", "21", "SUN", "Sun", "Sunday", ...
user avatar
3 votes
1 answer
57 views

mixing date formats in the same document

I am trying to make dates in my CV uniform so I thought of using the datetime2 package. The problem is that sometime I have a full date, sometimes the year and the month, and sometimes only the month. ...
user avatar
  • 2,793
0 votes
1 answer
37 views

Turn showdow off for one date in document

MRE: % Preamble \documentclass[11pt]{article} % Packages \usepackage[showdow,en-GB]{datetime2} % Document \begin{document} % Turn off showdow \DTMlangsetup{ord=raise,showyear=true,showdow=...
user avatar
2 votes
1 answer
77 views

datetime2: Assuming missing inputs of minutes or seconds to be zero

I would like to make the following document print output of 07:00 PM. \documentclass{article} \usepackage[calc,english]{datetime2} \DTMnewtimestyle{ampm}{% % \DTMdisplaytime{<hh>}{<mm>}...
user avatar
  • 8,759
2 votes
1 answer
45 views

Combine datetime2 and csvsimple

How can I make the following code compile: \documentclass{standalone} \usepackage{csvsimple} \usepackage{datetime2} \usepackage{filecontents} \begin{filecontents*}{test.csv} a,b 2019,00:00:00 2019,...
user avatar
  • 179
2 votes
1 answer
1k views

Changing date format in datetime2

Using the datetime2 package, how do I tell \today to display the date in the format: 'Fri, March 1, 2019'? \documentclass{article} \usepackage{datetime2} \begin{document} \today \end{document}
user avatar
  • 1,994
1 vote
1 answer
128 views

Calculating time spans with datetime2

With datetime2, is there a way to calculate an end time from a start time if I have the duration in minutes? Something like \newcommand*\timespan{90} \newcommand*\starttime{13:45:00} \DTMtime{\...
user avatar
  • 960
1 vote
2 answers
290 views

datetime2: Formatting the time

How can I get an output of 09:00 AM instead of 9am? \documentclass{article} \usepackage[en-GB]{datetime2} \begin{document} \DTMtime{09:00:00} The desired output is ``09:00 AM" \end{document}
user avatar
  • 8,759
0 votes
1 answer
104 views

How to create user defined time table

I have to create a three years work plane, but it still only shows me 4 months, How do I need to do? \documentclass{article} \usepackage{etoolbox} \usepackage{parskip} \...
user avatar
  • 211
5 votes
1 answer
499 views

datetime2: scientific english format

I'd like to typeset dates with the datetime2 package in English in the format commonly used in scientific or technical writing, that is: time in 24-hour format; dates in the format: "29 October 2018" ...
user avatar
7 votes
1 answer
674 views

Remove the leading zero from date

I like to print dates formatted in this way: 6 October 2018. Usually, I just type the date by hand. But I tried to set things up so that \today would format dates the way I like. I must have only ...
user avatar
  • 1,894
1 vote
1 answer
477 views

latex date calculations with datetime2 and ddmm format

I've been trying to to display dates in the format "dd"/"mm" (months preferably roman letters) - however I can't find a single style that supports this requirement. Additionally I'm trying to ...
user avatar
  • 11
5 votes
1 answer
1k views

How to automatically set CreationDate on PDF

When compiling a document using pdflatex one can set the PDF CreationDate of the document using \pdfinfo{...}. I would like to automatically set this to the date supplied to \date{...} in the document....
user avatar
  • 985
0 votes
2 answers
249 views

How to get the datetime2 package to display dates in South African format: "1 April 2018"

By default Latex formats the date as mmm d, yyyy, i.e. in the nonsensical middle endian format. I would like to display it as d Mmm yyyy, e.g. 1 April 2018. I've gone through the datetime2 ...
user avatar
  • 227
1 vote
1 answer
178 views

datetime2 does not respect polyglossia language settings (using lualatex)

datetime2 does not automatically deduces the correct language from the polyglossia settings. If you set the date style by hand, it works. (datetime2-german is installed.) I'm using lualatex (this ...
user avatar
  • 67
1 vote
1 answer
178 views

Use output of gitinfo2 package with datetime2 commands

The gitinfo2 package provides the command \gitAuthorDate which returns the date of the current commit in ISO format, e.g., 2018-02-22. I would like to use this date with a different format within in ...
user avatar
3 votes
1 answer
447 views

How to specify a date and make calculations with it in datetime2?

I want to specify a date (and give it a name) in a master header TEX-file, then refer to that date in several independent daughter files. As this doesn't even work within a single file, this ...
user avatar
  • 1,465
2 votes
1 answer
270 views

\DTMsavedate calculation does not work with \DTMusedate

I would like to calculate a new date based on a previous one with \DTMusedate, but I got an error from \@dtm@parsedate. Here's a sample : \documentclass[a4paper]{article} \usepackage[calc]{...
user avatar
  • 254
7 votes
2 answers
1k views

datetime2: define and explicitely use date formats

As datetime is superseded by datetime2, I'm struggling hard to achieve the following using the new package: In an English document, I would like to show the current date (\today) once like this 20th ...
user avatar
1 vote
2 answers
605 views

Input a date to `datetime2` in a format different than iso

Having a date stored in a macro: \def\Mydate{20-12-2017} I would like to do some calculations (advance days/months) using datetime2. If \Mydate stores the date in yyyy-mm-dd I won't have issues, but ...
user avatar