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
11
votes
2answers
907 views

Change month names in \today command

The \today command will print the Latin name of the month with the nynorsk language option. I would like to change this by using the more traditional (and still very commonly used in speech) system of ...
9
votes
3answers
2k views

How do I extract a month name in datetime2?

In datetime, there was a macro which provided the long name of the month, so if I have saved a date as, say, gitdate, I can extract the month name by: \monthname{\getdatemonth{gitdate}} Is there ...
7
votes
1answer
418 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 ...
6
votes
1answer
579 views

How does showdow work in datetime2?

Since datetime is no longer getting bug fixes, I've been looking at the possibility of switching to datetime2. However, aside from the fact that I'd need to write my own language module, I can't even ...
5
votes
2answers
238 views

Date format changed by loading pdfcomment package

It seems by loading the pdfcomment package, the date format is implicitly changed to YYYY-MM-DD. Consider the following MWE: \documentclass[12pt]{scrartcl} \usepackage[american]{babel} \usepackage[...
5
votes
2answers
48 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 ...
5
votes
1answer
77 views

Exctract 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} { ...
5
votes
2answers
2k views

Formatting datetime2 in LaTex to 4th September, 2016 without the current day?

I'm currently using \usepackage[UKenglish]{babel} \usepackage{datetime} and I'm getting Sunday 4th September, 2016 with the commands \today or with \newdate{example}{01}{09}{2016} (outside of \...
5
votes
2answers
431 views

Replicate behavior from datetime package with datetime2 package

The datetime package is now obsolete and I would like to switch to the newer datetime2 pacakge, but I am having trouble recreating the behavior that I used the datetime package for. The following MWE ...
5
votes
2answers
499 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 ...
4
votes
2answers
157 views

datetime2, norwegian day of week missing

I have tried to figure out how to enable printing the day of week, but I cannot seem to be able to do this for norwegian. It works fine for British. I do realize that it might be because it is ...
4
votes
2answers
129 views

store a date with datetime2 and use it with termcal

I am making a class syllabus using the "termcal" package and would like to store the starting date for the first class so I can use it for different elements of the syllabus. I am currently trying to ...
4
votes
1answer
410 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....
4
votes
1answer
144 views

Problem using the acro-package and \today

I have a problem using the tooltip option of the acro-package and the command \today. In my document i load \usepackage[tooltip = true]{acro}, where the option tooltip=true loads the package ...
3
votes
1answer
78 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" ...
3
votes
1answer
160 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 ...
3
votes
2answers
213 views

How to calculate previous month from \today using datetime2?

Is is possible to use datetime2 to calculate the previous month from \today? (Alternatively another package). I've found some solutions that use negative deduction of days, but that would cause ...
3
votes
1answer
511 views

Pdflatex fails when using datetime package

I have been debugging a class that uses the datetime package. It seems the offending statement is a \RequirePackage{datetime}. It seems that including the datetime package is causing pdflatex to fail....
3
votes
1answer
192 views

datetime2 — Warnings when using showyear setting

With the following MWE, I get two warnings: \documentclass{article} \usepackage[en-US]{datetime2} \begin{document} \DTMlangsetup{showyear=false} \DTMdate{2017-03-13} \DTMlangsetup{showyear=true} \...
3
votes
1answer
170 views

Get full iso format date and time with colon and “T” separator

When I use iso style with datetime2 package, I exepect to get the full date format with T separator between date and time and colon “:” between hours, minutes, and seconds. I expect someting like ...
3
votes
3answers
707 views

Add (n) days to variable date

I'm trying to add a variable date to a variable number. I'm currently trying to use the datetime2 package. I'm trying to get something like this (not actually working): \documentclass[10pt]{article} ...
3
votes
1answer
38 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. ...
3
votes
1answer
354 views

Change to short Monthname in datetime2 (german)

I use \usepackage[ngerman]{datetime2} and try to create a date which uses the short form of the Monthname. When I type \DTMdate{2016-12-4} I get as result 4. Dezember 2016. But I want the short ...
3
votes
1answer
122 views

scrlttr2 document fails with datetime2 package

When using the datetime2 package in a scrlttr2 document, I get the error: /usr/share/texlive/texmf-dist/tex/latex/datetime2/datetime2.sty:368: LaTeX Error: \today undefined. See the LaTeX ...
3
votes
1answer
2k views

Where can I get datetime2.sty or what is CTAN?

I am trying to build a huge latex project on my system - I downloaded everything, and did not touch anything. XeLaTeX tells me that datetime2.sty is missing, and I guess I just have to download it, ...
3
votes
1answer
286 views

How should language aliases be used with datetime2?

Consider the following code: \documentclass[british]{article} \usepackage{babel} \usepackage[utf8]{inputenc} \usepackage{datetime2} \DTMsetup{useregional} \DTMlangsetup[en-GB]{ord=raise} \begin{...
3
votes
0answers
160 views

Datetime2 package example usage for new era definition

Background I want to create a timeline that is based on years, but I don't want to handle a mix of negative and positive numbers (i.e. BC/AD which gives us this year as 2016 and 4032 years ago is ...
2
votes
1answer
698 views

Help with US Date Format

I have searched the isodate package and the datetime2 package to answer my question. I would like my date to be mm/dd/yyyy. The closest I have gotten is to have the date as dd/mm/yyyy. Could someone ...
2
votes
1answer
33 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]{...
2
votes
1answer
22 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,...
2
votes
2answers
253 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}
2
votes
1answer
122 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]{...
2
votes
1answer
489 views

Titling package and date formatting

I am using the titling package the resuse the defined date etc. using a plain \thedate command. However the date format is not what I need because of different type of localization. My first shot was ...
2
votes
1answer
74 views

Change pre-defined date in command and save to datetime2 - expansion issue?

A date is predefined in the format 12 June 2015 and I need package datetime2 to modify the date and translate it in other languages. However, it does not work in the following way: \documentclass[...
2
votes
1answer
46 views

datetime2's \DTMsavetimestamp can't read from macro - expansion or catcode issue?

What already works I am using \immediate\write18 to let the GNU date command do some date/time arithmetic. The resulting timestamp in ISO format (e.g., 2011-09-09T09:59:59Z) is written to a temporary ...
2
votes
1answer
44 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", ...
2
votes
1answer
28 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>}...
2
votes
1answer
140 views

Package tracklang Error: Dialect `iso' is not predefined

I added the package datetime2 so i could write out the todays time in the ISO standard. \usepackage[iso]{datetime2} I get a error saying that iso is not predefined. datetime2.sty 159 Package ...
2
votes
1answer
38 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 ...
2
votes
0answers
57 views

Listing Schedules By Week and by Specific Dates Using `datetime`

I am using datetime to automatically generate a schedule. The MWE at the moment allows me to list weeks (and dates of the beginning and the end of each weak). But I would like to combine this with ...
1
vote
2answers
721 views

Use swedish format in datetime2

I'm trying to use swedish date format by when using the package datetime2. I have found the following link https://www.ctan.org/pkg/datetime2-swedish but I don't understand how to call for this one. ...
1
vote
2answers
346 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 ...
1
vote
2answers
298 views

datetime2 doesn't expand months in \DTMDisplaydate

I want to use strings for dates in my document that can be formatted either as ISO or German later on. I looked at isodate datetime and datetime2 most promising seemed to be the latest, but the ...
1
vote
1answer
54 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{\...
1
vote
1answer
150 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 ...
1
vote
1answer
464 views

Display custom date in the correct regional style with datetime2

I'm trying to get datetime2 to display a custom date in the proper regional style, either using the language setting defined through polyglossia, or by passing the language setting through datetime2 ...
1
vote
1answer
75 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 ...
1
vote
1answer
88 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 ...
1
vote
1answer
153 views

Change the case of datetime2 month return

I'm trying to automate report generation in czech. In english, there is no problem using solution from this thread. Same behaviour is for \monthname command from datetime package. The problem is, ...
1
vote
2answers
169 views

Expansion of argument to DTMdate function in datetime2

I need a very simple associative array for my project which I am trying to implement as in the following MWE. Two questions please: How do I need to tweak my \alistget macro to allow its result to ...