1

using 'datetime' package, one can produce a custom date with custom date format like this:

\usepackage{datetime}

\newdateformat{nwfmt}{\the\day, \THEDAY \monthday, \THEYEAR}
\newdate{mydate}{21}{12}{2020}

\begin{document}
\nwfmt
\mydate

\end{document}

but this does not give what i want. I want something like this: "monday, 21 december, 2020", i.e. full name of day and month and no uppercase.

1 Answer 1

2

The \DayName from scrdate could be easily converted to lowercase, but the \monthname had to be explicitly defined (anglicizing Werner's answer). That's the best solution I could get for a complete lower-case date, looking like:

Lower-case date

\documentclass[border=2pt]{standalone}

\usepackage{datetime, scrdate}

\newdateformat{nwfmt}{\MakeLowercase{\DayName{\THEYEAR}{\THEMONTH}{\THEDAY}},
                      \THEDAY\ \monthname[\THEMONTH], \THEYEAR}

\makeatletter
\renewcommand{\monthname}[1][\month]{%
  \@orgargctr=#1\relax
  \ifcase\@orgargctr
    \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
      Month numbers should go from 1 to 12}%
    \or january%
    \or february%
    \or march%
    \or april%
    \or may%
    \or june%
    \or july%
    \or august%
    \or september%
    \or october%
    \or november%
    \or december%
    \else \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
      Month numbers should go from 1 to 12}%
  \fi}
\makeatother

\newdate{mydate}{21}{12}{2020}

\begin{document}

\nwfmt\displaydate{mydate}

\end{document}
3
  • i forgot to mention that i also want the ^st, ^nd, ^rd, ^th Jun 2, 2021 at 4:24
  • 1
    Your solution lies on page 8-9 of the datetime documentation. BTW: There is a way of expressing appreciation to answers you find useful by upvoting or accepting them... I hope you are aware of that !
    – Partha D.
    Jun 2, 2021 at 4:46
  • i'll do that in a later time Jun 2, 2021 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.