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
1 vote
0 answers
48 views

datetime2 warning in connection with babel: Date-time language module 'english' not installed

When I try to use the package datetime2 in conjunction with babel (English), I receive the following warning in the log: Package datetime2 Warning: Date-Time Language Module `english' not installed on ...
serval's user avatar
  • 107
-1 votes
1 answer
38 views

day and year counters in foreign digits

I'm trying to get the day and year numerals in foreign digits. So far I've been able to get the month names with a \newcommand \date<lang>. The language is sanskrit and the script is devanagari. ...
user1850133's user avatar
0 votes
1 answer
40 views

Calculations from fixed dates, how to add days

Writing fiction I would like to keep my calendar dates and time spans between events tracking contained within the source itself, and therefore need to do something (I though just as simple as) ...
Erik Itter's user avatar
1 vote
1 answer
47 views

advdate and datetime2 with day of week

I'd like to increment the date in the format [Day of week] [Day] [Month] [Year] by one each step, but I can't get the day of the week to increment. I've been looking at this answer but I can't get dow ...
alice19's user avatar
  • 746
5 votes
1 answer
58 views

How to calculate dates to pass as arguments to pdfgantt?

I'm trying to work with dates in Latex (via Overleaf) with the datetime2 and pdfgantt packages. I have created a command to increment a date using \DTMsavejulianday. The below code shows that it is ...
IanS's user avatar
  • 153
1 vote
1 answer
41 views

Define a `\DTMifdate` conditional using the `datetime2` package and `\today`

I got a question regarding the usage of the datetime2 package. I want to set some due date and to define a certain date such as \paperdate which is either \today when it's before the due date or the ...
pahohu's user avatar
  • 229
1 vote
1 answer
48 views

How to customize display of date and time of compiling

How do I customize date and time display for the compile date and time? I see the datetime2 package gives many predefined options, but what if I want to do something unique? The datetime2 mentions the ...
BrianWilson's user avatar
1 vote
1 answer
96 views

Redefine the abbreviated months with datetime2 package

I was wondering if there is a way to redefine the abbreviated months with datetime2 package, such that, when using the command \today, months are written exactly like the first column of the image ...
AEW's user avatar
  • 819
0 votes
1 answer
57 views

Formatting \DTMuseDate with a custom format

I created a custom format and saved a date like this: \usepackage[ngerman]{datetime2} \DTMnewdatestyle{dateMonat}{\THEDAY. \monthnamengerman[\THEMONTH]} \DTMsavedate{dateABC}{2023-07-20} I want to ...
Benedikt Wotka's user avatar
1 vote
0 answers
170 views

Updated way of including latin and greek languages?

I have had the following code in my custom classes to handle latin and greek: \documentclass{article} \usepackage{polyglossia} \setotherlanguage[variant=classic]{latin} \newfontfamily\latinfont[Script=...
Dan-Erik Lindberg's user avatar
-2 votes
1 answer
238 views

Set specific Time Zone, WRT local time

I am trying to adapt code, from a prior relevant answer, which I copy below: \documentclass[en-MT]{article} \usepackage[calc,useregional]{datetime2} \begin{document} \DTMsetstyle{en-MT-numeric} \...
温泽海's user avatar
1 vote
1 answer
125 views

Calendar current week in color

I want to display for each week a page containing the number of the week in the year, the date of Monday and that of Saturday in numerical form and a calendar of the current month on which the current ...
Dhénin Jean-Jacques's user avatar
4 votes
3 answers
199 views

How to insert the next month, like /today?

I'd like to create a command that would insert the next month (in relation to the current one), like so: \command -> November analogously to \today. The command cannot be hardcoded, as the ...
Zubo's user avatar
  • 582
1 vote
0 answers
63 views

How can I save \today using \DTMsavedate?

This question is almost identical to this other question, but unfortunately the proposed solution there does not work in my scenario. I'm trying to write a package for a certain beamer style and ...
cryingshadow's user avatar
  • 2,320
1 vote
0 answers
41 views

datetime2 "number too big" error when eliminating separators

I'm trying to produce a date/time output as a string of numbers without any separators: yyyymmddHHMMss. I was able to use the yearmonthsep= and other options in datetime2 to eliminate any colons or ...
jmcelroy's user avatar
1 vote
2 answers
153 views

Automated age calculation by Lualatex

I came across an 11 year old query "Automated age calculation" about how to automate the calculation of a person's age. Something like: I'm \myage{day}{month}{year} years old. Another ...
JardaFait's user avatar
  • 3,850
0 votes
1 answer
127 views

Get the first day of the week and the weekend

I am working on a weekly teaching plan. I need the start date and end date of each week. For example, week 30 I want 7/25 - 7/29, week 31 I want 1/8 - 5/8. I don't want to do this manually, because it ...
Nguyễn Cảnh Dũng's user avatar
6 votes
2 answers
258 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 ...
zetyty's user avatar
  • 769
2 votes
1 answer
476 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 &...
zetyty's user avatar
  • 769
4 votes
1 answer
63 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, ...
Timmy's user avatar
  • 95
2 votes
1 answer
322 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 ...
Jinwen's user avatar
  • 8,092
2 votes
1 answer
180 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 ...
mimuller's user avatar
  • 800
2 votes
3 answers
364 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 ...
Apen13's user avatar
  • 31
0 votes
0 answers
217 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 ...
duy phạm's user avatar
4 votes
1 answer
185 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 ...
fauve's user avatar
  • 2,457
5 votes
2 answers
146 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 ...
Evan Aad's user avatar
  • 10.9k
0 votes
2 answers
207 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 ...
Brailyn's user avatar
2 votes
1 answer
644 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> ...
murray's user avatar
  • 7,756
6 votes
1 answer
327 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 ...
Concerto's user avatar
  • 113
2 votes
1 answer
72 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{...
AlexG's user avatar
  • 54.1k
9 votes
1 answer
680 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 ...
Sebastiano's user avatar
  • 52.7k
4 votes
1 answer
292 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} \...
Sebastiano's user avatar
  • 52.7k
-1 votes
1 answer
108 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 ...
fauve's user avatar
  • 2,457
5 votes
2 answers
333 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 ...
Pygmalion's user avatar
  • 6,167
2 votes
1 answer
332 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{...
Minh Nghĩa's user avatar
1 vote
1 answer
219 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 ...
ShadowEagle's user avatar
0 votes
1 answer
172 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 ...
Guido's user avatar
  • 1
0 votes
1 answer
76 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{...
Oromion's user avatar
  • 362
4 votes
1 answer
378 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} \...
kjekk's user avatar
  • 43
0 votes
1 answer
168 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....
Dirk's user avatar
  • 2,708
0 votes
0 answers
159 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
243 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}...
N3buchadnezzar's user avatar
2 votes
1 answer
57 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 ...
Erwann's user avatar
  • 2,080
5 votes
2 answers
310 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 ...
Isabella B's user avatar
2 votes
1 answer
576 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]{...
noibe's user avatar
  • 2,064
7 votes
1 answer
569 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} { ...
N3buchadnezzar's user avatar
1 vote
1 answer
136 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", ...
user20311's user avatar
3 votes
1 answer
69 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. ...
aaragon's user avatar
  • 3,019
0 votes
1 answer
67 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=...
Adam Williams's user avatar
2 votes
1 answer
100 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>}...
Diaa's user avatar
  • 9,353