Skip to main content

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
32 views

Displaying seconds accurately with datetime2

I'm using datetime2 under xelatex. Is there any way to get it to display the time in the format hh:mm:ss with an accurate value for the seconds? Currently, the output for seconds is always "00&...
serval's user avatar
  • 107
2 votes
1 answer
95 views

How to display \time in terms of hours and minutes?

I found that I can display \time writing \the\time, but this seems only to count minutes. So informally, the hours are \the\time / 60 and the minutes are \the\time % 60. But how can I get the form hh:...
user2609605's user avatar
6 votes
1 answer
275 views

How to get the first three letters of today’s day of week?

I tried using the package datetime2 to get the whole name of today’s day of week and then xstring to trim it as desired. But when I run the following code, the result is not trimmed at all: \...
Myvh's user avatar
  • 63
3 votes
1 answer
42 views

Clash of the ctable package with the datetime package if the showdow option is set

Loading the datetime2 package with the showdow option creates a clash with the ctable package, at least for me. Without the showdow option there are no problems. The following MWE shows the error ...
Dietrich Baumgarten's user avatar
0 votes
1 answer
118 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
41 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
  • 1,028
0 votes
1 answer
56 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
122 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
87 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
70 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
104 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
144 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
108 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
182 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
287 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
176 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
225 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
105 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,350
1 vote
0 answers
45 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
189 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,974
0 votes
1 answer
184 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
268 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
  • 777
2 votes
1 answer
635 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
  • 777
4 votes
1 answer
83 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
587 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,618
2 votes
1 answer
230 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
  • 872
2 votes
3 answers
383 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
259 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
265 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,531
5 votes
2 answers
167 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
  • 11.1k
0 votes
2 answers
282 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
859 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
  • 8,692
6 votes
1 answer
338 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
82 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
  • 55.4k
10 votes
1 answer
794 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
  • 56.7k
4 votes
1 answer
356 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
  • 56.7k
-1 votes
1 answer
140 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,531
5 votes
2 answers
388 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,329
2 votes
1 answer
417 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
245 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
211 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
80 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
  • 394
4 votes
1 answer
468 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
191 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,728
0 votes
0 answers
169 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
277 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
59 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,130
5 votes
2 answers
347 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
3 votes
1 answer
685 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,094
7 votes
1 answer
680 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