1

I am using the package like this:

\usepackage[nodayofweek, short]{datetime}

So when I am using \today it shows exactly what I want like this:

enter image description here

So I have two questions. One, how to omit the year? Two, how to show a specific date in a format like this, for example, Jun 15th.

Thank you for your help.

2
  • Welcome to TeX.SE!
    – Mensch
    Commented Jul 4, 2023 at 18:11
  • \formatdate{<day>}{<month>}{<year>} formats the given date in the current format. You can define a new format with \newdateformat{mydateformat}{\ordinaldate{} \shortmonthname} and then say \mydateformat\formatdate{<day>}{<month>}{<year>}.
    – cfr
    Commented Jul 4, 2023 at 19:46

1 Answer 1

3

datetime is obsolete, you should be using datetime2 instead. Which has excellent documentation, by the way (not to mention a lot of threads on this forum.) That said, take a look at this MWE:

\documentclass{article}

\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise,showyear=true}

\begin{document}

\today

\DTMdate{2023-06-15} 

\DTMlangsetup[en-GB]{showyear=false}
\DTMdate{2023-07-05}

\end{document}  

enter image description here

4
  • Give me bilingual support for Welsh and English in datetime2 and I'll 'upgrade' from datetime. Until then ... ;). (I know this is not the OP's question, but datetime supports functionality I need - not everybody is supported by datetime2.)
    – cfr
    Commented Jul 4, 2023 at 19:36
  • See e.g. tex.stackexchange.com/questions/261641/…. (I gather from Nicola's updated answer that datetime2 may now be a bit more flexible, But if you want Welsh dates, you'll still get the wrong output for e.g. ordinals. I have a corrected version for datetime (which I'm not allowed to distribute without renaming), but zilch for datetime2. The code for the latter is far beyond me, so I can't roll my own the way I did for datetime.)
    – cfr
    Commented Jul 4, 2023 at 20:25
  • Obviously this was in reply to OP's question. He seems to be from Hong Kong, and supposedly content using a British standard date format. If an author publicly states that his package is „obsolete” and points to a successor, that's usually good enough for most users – unless they have a specific reason not to upgrade and know what they're doing.
    – Ingmar
    Commented Jul 5, 2023 at 5:36
  • Yes, because 'obsolete' typically means the functionality is provided in a better way by some alternative. In this case, that's absolutely not the case. I'd have no problem if the package author declared it 'unmaintained' but declaring it obsolete risks getting it removed from distros etc., even though there's no alternative for (some) minority languages. The Welsh version still includes bits I'm told are Breton. (So does datetime, but that's easy to correct.) I can't even distribute the corrected file for datetime except with an instruction to rename it b/c it would violate the licence.
    – cfr
    Commented Jul 5, 2023 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .