# Bibliography: How can I use a date in any field?

Sometimes I would like to use a date in \titleaddon or any field, but neither \printdate nor \bibdate nor \mkbibdate ... works, though I've loaded isodate.

\documentclass{scrartcl}
\usepackage{etex}
\usepackage{filecontents}
\usepackage[main=ngerman]{babel}
\usepackage[ngerman]{isodate}
\usepackage[pdftex]{hyperref}
\usepackage[style=philosophy-modern, sortlocale=auto, sorting=nyvt,
alldates=terse, eventdate=comp,
language=ngerman, origdate=comp,
datezeros=false,backend=biber,labeldateparts=true,
autolang=hyphen, clearlang = true]{biblatex}

\begin{filecontents*}{thebib.bib}
@Book{Kant:KrV,
author =   {Immanuel Kant},
title =    {Kritik der reinen Vernunft},
titleaddon =   {\autocap zuerst vorgelesen am \mydate{1780-07-19}},
language =     {german},
year =     1781,
publisher =    {Hartknoch},
location =     {Riga}}
\end{filecontents*}

\begin{document}

\nocite{*}
\printbibliography
\end{document}


Other possibilities being

\titleaddon{\autocap zuerst vorgelesen am \mydaterange{1780-07-19}{1781-11-07}}



for lectures

\mydaterange{1780-07-19T15:30:00}{1780-07-19T17:00:00}

• How should the date be printed? – samcarter_is_at_topanswers.xyz Oct 12 '17 at 20:36
• The isodate command \daterange does work (I'm not sure how to get it to print the time as well). \printdate however is also a command defined by biblatex, and it does not take an argument (and apparently biblatex's definition of it takes precedence over isodate's definition). – gusbrs Oct 12 '17 at 21:16
• @samcarter The date should look like all other dates. – Alexander Wittmann Oct 12 '17 at 21:42

biblatex has its own \printdate which prints the date of the entry. So in citations and the bibliography isodate's \printdate is masked by biblatex's definition. The easiest solution is to save \printdate in another macro and use that instead.

\documentclass{scrartcl}
\usepackage{filecontents}
\usepackage[main=ngerman]{babel}
\usepackage[ngerman]{isodate}
\let\idprintdate=\printdate
\usepackage[style=philosophy-modern]{biblatex}

\begin{filecontents*}{\jobname.bib}
@book{Kant:KrV,
author     = {Immanuel Kant},
title      = {Kritik der reinen Vernunft},
titleaddon = {\autocap{z}uerst vorgelesen am \idprintdate{1780-07-19}},
language   = {german},
year       = 1781,
publisher  = {Hartknoch},
location   = {Riga},
}
\end{filecontents*}

\begin{document}

\nocite{*}
\printbibliography
\end{document}


You can also use datetime2, whose command names don't clash with biblatex commands. Instead of isodate load

\usepackage[useregional]{datetime2}


and then use

  titleaddon = {\autocap{z}uerst vorgelesen am \DTMdate{1780-07-19}},


\bibdate and \mkbibdate are not defined by biblatex. There are the macros \mkbibdatelong and \mkbibdateshort, but you can't use them in this situation, they have to operate on date-like fields in the .bbl. There are also some macros that begin with \bibdate... but those mainly customise the date output by biblatex's macros, they don't print a date themselves.

• DTMdate works, but \DTMtime{14:00:00} doesn't. It produces the error Runaway argument? [...] ./Bibliographie.tex:383: Paragraph ended before \@dtm@parsetime was complete. <to be read again> \par, even though I made : inactive as it says in datetime2.pdf, p. 15 "Take care if you use babel with a language setting that makes the colon character active. You will have to switch off the shorthands in order to use this command correctly." – Alexander Wittmann Oct 16 '17 at 13:02
• @AlexanderWittmann titleaddon = {\autocap{z}uerst vorgelesen am \DTMdate{1780-07-19} \DTMtime{14:00:00}}, works brilliantly for me with \usepackage[useregional]{datetime2} in the above MWE. Please ask a new question with an MWE that reproduces the problem. – moewe Oct 16 '17 at 13:18
• That's not an easy thing to do as my preamble is extremely long. I'll try. I thought there might be something like an escape command so that it doesn't get confused and looks for an end of a paragraph. – Alexander Wittmann Oct 16 '17 at 17:20
• @AlexanderWittmann Can you use \DTMtime{14:00:00} in the document directly, or does that also cause an error? Anyway, with binary search it should be possible to find the culprit rather quickly. (You can probably eliminate some packages immediately.) – moewe Oct 16 '17 at 17:28
• I can use it. The other thing I'll try tomorrow as I've changed the format of nearlty everything. – Alexander Wittmann Oct 16 '17 at 17:37