Latest news 2024-07-03: Ebook sale (1st – 31st July 2024): short story cybercrime fiction Unsocial Media free; short story cybercrime fiction Smile for the Camera free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

datetime2 package FAQ

How do I modify a regional date style? 🔗

You can use the options that are provided by the style for minor modifications, such as the example given in How do I make the date appear in my regional format instead of the default ISO format? If you have a more significant change that can’t be obtained through the style options, then you can define your own style.

For example, suppose you want the date in the form 2021-Aug-01. This has the year at the start but it uses an abbreviated English month name and a two-digit day. This format can’t be obtained with any of the styles provided by datetime2-english, so a new style is needed.

First you need to make sure that the English month name commands are provided, so you need to load datetime2 with en (the ISO language code for English), but you don’t want to switch to that style so you also need useregional=false:

Now you can define a style that uses the English commands:
 {yyyyMonthdd}% label
 {% style commands
      \number##1 % year
      -% separator
      \DTMenglishshortmonthname{##2}% abbreviated month
      -% separator
      \DTMtwodigits{##3}% two-digit day
Remember that you need to set the style once it’s defined:

2023-04-14 10:07:16

Alternative link:

Category: datetime2 package
Topic: Localisation