使用\formatdate
from datetime
,我可以获得以多种语言正确格式化的日期:
\formatdate{3}{4}{2012}
但是,我只想使用日期和月份,而不用年份。我尝试传递:
\formatdate{3}{4}{\empty}
但它不起作用,因为它需要一个数字。
我怎样才能实现这个目标?
答案1
\makeatletter
\def\formatdateny{\csname noyear\languagename\expandafter\endcsname\formatdate}
\def\noyearenglish#1, \the\@year{#1}
\let\noyearamerican\noyearenglish
\let\noyearbritish\noyearenglish
\def\noyearfrench#1\space\number\@year{#1}
\let\noyeargerman\noyearfrench
\let\noyearaustrian\noyeargerman
\let\noyearswedish\noyearfrench
\let\noyearbreton\noyearfrench
\def\noyearrussian#1\ \number\@year~\cyrg.{#1}
\def\noyearspanish#1\ de~\number\@year{#1}
\let\noyearcatalan\noyearspanish
\def\noyearbasque#1\number\@year.eko\space{#1}
% etc.
\makeatother
\formatdateny{3}{4}{2012}