1

I'm writing my document in British English, but live in the Netherlands. In the Netherlands, the short date format is dd-mm-yyyy, as opposed to the British dd/mm/yyyy.

How can I get biblatex to use this date format for its short dates?

I can't use the solution in this answer to a related question, as that would also change the localisation of the bibliography, and frankly, the other answers to that answer are pretty much Greek to me. Surely there must be an easier way?

I've tried adding \usepackage[dutch]{datetime2}, \DTMsetdatestyle{dutch}, but that has no effect whatsoever.

MWE:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{key,
    author = {A. Author},
    title = {Some title},
    url = {example.org},
    urldate = {2019-12-31}
}
\end{filecontents}

\usepackage[british]{babel}
\usepackage[backend=biber,style=ieee]{biblatex}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{key}

\printbibliography

\end{document}

Using \usepackage[dutch]{babel} is able to give the right date format, so it should be possible.

Current output is

A. Author, “Some title”, [Online]. Available: example.org (visited on 31/12/2019).

Desired output:

A. Author, “Some title”, [Online]. Available: example.org (visited on 31-12-2019).

1 Answer 1

3

You can copy the date formatting macros \mkbibdatelong and \mkbibdateshort from the Dutch language module dutch.lbx and use them in \DefineBibliographyExtras. This probably qualifies as looking a bit Greek, since it essentially does the same as the accepted answer to Main text and bibliography in two languages but with alternate date format (except the linked answer uses a new .lbx file, whereas we just write the code into the preamble with a slightly different command), but I feel that this is the intended way to do things. While biblatex lets you easily choose between different formats for the same language with options (urldate=long/urldate=short for example), it is a bit more involved if you want to use a format not supported by the language files because that involves redefining one or more of the macros responsible for printing the dates.

\documentclass{article}

\usepackage[british]{babel}
\usepackage[backend=biber,style=ieee]{biblatex}

\DefineBibliographyExtras{british}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{\mbox{-}}}%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#1}{}{\mbox{-}}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{key,
    author = {A. Author},
    title = {Some title},
    url = {example.org},
    urldate = {2019-12-31}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{key}

\printbibliography
\end{document}

visited on 31-12-2019

1
  • Thanks, this works. For future readers, note that the first part (\def\mkbibdatelong...) also changes the long format from ordinal numbers to normal numbers, i.e. 1st Jan. 2000 becomes 1 Jan. 2000. In my case, I like this.
    – BrtH
    Apr 16, 2019 at 10:34

You must log in to answer this question.

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