Formatting dates “day month year” with biblatex
Ah, a use for the australian
language. Its date format is correct, so you can load it as a subsiduary language via babel
and then wrap your bibliography in an otherlanguage
environment:
\documentclass{article}
\usepackage[australian,american]{babel}
\usepackage[backend=biber,dateabbrev=false]{biblatex}
\begin{filecontents}{references.bib}
@book{Book,
title = {This is a Title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
date = 2005,
month = feb,
day = 14,
}
\end{filecontents}
\addbibresource{references.bib}
\begin{document}
\today
Citing \cite{Book}.
\begin{otherlanguage}{australian}
\printbibliography
\end{otherlanguage}
\end{document}
As the manual says :
The biblatex package always treats [english] as an alias for american. It is preferable to use the language identifiers american and british
you can use something like :
\documentclass{article}
\usepackage[british]{babel}
\usepackage[backend=biber,dateabbrev=false]{biblatex}
\begin{filecontents}{references.bib}
@book{Book,
title = {This is a Title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
date = 2005,
month = feb,
day = 14,
}
\end{filecontents}
\addbibresource{references.bib}
\begin{document}
\today
Citing \cite{Book}.
\printbibliography
\end{document}
or
\documentclass{article}
\usepackage[british]{babel}
\usepackage[babel=other,backend=biber,dateabbrev=false]{biblatex}
\begin{filecontents}{references.bib}
@book{Book,
title = {This is a Title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
hyphenation = {british}
date = 2005,
month = feb,
day = 14,
}
\end{filecontents}
\addbibresource{references.bib}
\begin{document}
\today
Citing \cite{Book}.
\printbibliography
\end{document}
You can use australian
, but that also affects hyphenation, comma, and quotation rules in comparison to american
(alias USenglish
). If you just want to make the day come before the month (in both long and short dates), you should just change the way the dates are printed in the american
/USenglish
language. Note that this will change the date format of the entire document, rather than just the bibliography.
The simplest way is to insert this in the preamble:
\DefineBibliographyExtras{USenglish}{%
% d-m-y format for long dates
\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}}}{\stripzeros{\thefield{#1}}}}%
% d-m-y format for short dates
\protected\def\mkbibdateshort#1#2#3{%
\iffieldundef{#3}
{}
{\mkdatezeros{\thefield{#3}}%
\iffieldundef{#2}{}{/}}%
\iffieldundef{#2}
{}
{\mkdatezeros{\thefield{#2}}%
\iffieldundef{#1}{}{/}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\mkdatezeros{\thefield{#1}}}}%
}
I wrote the code with the alias USenglish
, but you can replace that with american
if you choose. They are two names for the same style. You need to be sure that it's the same alias used when calling \usepackage{babel}
, though. (If you change the properties of USenglish
, don't expect the changes to be carried over to american
!)
A more elegant solution is to make an .lbx file to stay more organized and make this style easily accessible in future documents. The code only differs at the beginning and end. You need to add \ProvidesFile
to the top and \endinput
to the bottom. Then add two \Inherit...
commands and change any \Define...
commands to Declare...
commands.
\ProvidesFile{USenglish-dmy.lbx}[USenglish localization with d-m-y format for dates]
\InheritBibliographyExtras{USenglish}
\DeclareBibliographyExtras{%
% d-m-y format for long dates
\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}}}{\stripzeros{\thefield{#1}}}}%
% d-m-y format for short dates
\protected\def\mkbibdateshort#1#2#3{%
\iffieldundef{#3}
{}
{\mkdatezeros{\thefield{#3}}%
\iffieldundef{#2}{}{/}}%
\iffieldundef{#2}
{}
{\mkdatezeros{\thefield{#2}}%
\iffieldundef{#1}{}{/}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\mkdatezeros{\thefield{#1}}}}%
}
\InheritBibliographyStrings{USenglish}
\endinput
Save this as USenglish-dmy.lbx
and then add this in your preamble: \DeclareLanguageMapping{USenglish}{USenglish-dmy}
. That's it! Now all dates should have the day before the month, and nothing else (e.g. hyphenation or quotation styles) is affected.
Thanks to moewe for this answer that helped me arrive at this solution.