Questions tagged [datetime2]

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

The datetime2 package provides commands for formatting dates, times and time zones and redefines \today to use the same formatting style. In addition to \today, you can also use \DTMcurrenttime (current time) or \DTMnow (current date and time). Dates and times can be saved for later use.

The accompanying datetime2-calc package can be used to convert date-times to UTC+00:00.

Language and regional support is provided by independently maintained and installed modules.

The datetime2-calc package uses the pgfcalendar package (part of the PGF/TikZ bundle).

This package replaces datetime.sty which is now obsolete.

102 questions
10
votes
3 answers

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 something similar in datetime2? I couldn't find…
9
votes
2 answers

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 December 2017 and once like this…
Markus Nißl
  • 267
  • 1
  • 6
7
votes
1 answer

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} { \str_case:nnF { #2 } { …
N3buchadnezzar
  • 11,348
  • 7
  • 55
  • 114
7
votes
1 answer

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 tested it when the day number was two digits. I…
dedded
  • 2,236
6
votes
1 answer

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 exactly like this: Mi, 18. November. Even better…
Concerto
  • 113
6
votes
1 answer

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" (no commas, no ordinals). How can this be done?…
5
votes
2 answers

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 and month without year, i.e. 21th March Is that…
Pygmalion
  • 6,387
  • 4
  • 34
  • 68
4
votes
1 answer

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, headlines=4, …
Timmy
  • 95
4
votes
2 answers

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 normally left out of dates in norwegian, but it should…
Runar
  • 6,082
3
votes
1 answer

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. I couldn't find a way to do this with the…
aaragon
  • 3,041
3
votes
2 answers

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 problems around the end of the month. Example: \today =…
3
votes
1 answer

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} \end{document} Those warnings are: Package…
JAB
  • 175
  • 1
  • 1
  • 11
3
votes
0 answers

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 also year 2016). My problem is that if I set the…
GaRyu
  • 295
2
votes
1 answer

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 argument cannot left empty. How should one display a…
Jinwen
  • 8,518
2
votes
1 answer

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…
noibe
  • 2,084
1
2