19

I would like to have Biblatex print only the year of a publication in the bibliography. Currently it shows the year, month and day.

The "date" option (e.g. date=iso8601) can't do that.

3
  • Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Jan 8, 2013 at 11:42
  • 1
    But the situation is really nothing special. Biblatex ALWAYS prints the full date (if provided) in the bibliography. This is not an error or something. I think a MWE is rather elaborate here, since citations are involved...
    – HWende
    Jan 8, 2013 at 11:46
  • 3
    Maybe date=iso8601 can't do it, but date=year seems to work fine for me. That option might be relatively new. Jun 6, 2014 at 15:08

2 Answers 2

20

In analogy to Disable month in biblatex bibliography? you can just disable the month and day fields with the commands

\AtEveryBibitem{\clearfield{month}}
\AtEveryBibitem{\clearfield{day}}

For a short moment there came to my mind that there could be a caveat with the urldate field that declares when a URL has been checked, but biblatex even takes care of this. The urldate is still printed as full date. Compare the MWE and its output below:

\begin{filecontents}{test.bib}
@BOOK{test,
author= {A. Author},
title = {A Title for a Book},
date = {2012-10-08}
},
@ONLINE{test2,
author = {A. Author},
title = {Some title},
url = {http://example.com},
urldate = {2013-01-08}
}
\end{filecontents}

\documentclass{article}
\usepackage{biblatex}
\addbibresource{test.bib}

\AtEveryBibitem{\clearfield{month}}
\AtEveryBibitem{\clearfield{day}}

\begin{document}
\nocite{*}

\printbibliography
\end{document}

enter image description here

Is this what you intend to do? If not, please provide a MWE to work with.

4
  • 1
    Perfect! I was not aware of a "\clearfield" command. Thank you so much! (Also, you proved me wrong on the 'elaborate' MWE!)
    – HWende
    Jan 8, 2013 at 12:18
  • 1
    The basic idea behind the MWE is to be only as elaborate as necessary. In many cases (I have to admit, not here) one finds the source of the problem by oneself or can at least limit it to a much smaller amount of code which makes it easier to ask the right question then. Jan 8, 2013 at 12:41
  • This solution creates a problem for me, where some references (which have a non-empty month field in the .bib file) have their month replaced by the Issue number (or maybe just whatever the previous field is).
    – level1807
    Aug 30, 2018 at 12:05
  • @level1807 Are you sure that it is caused by this solution? Can you prepare a minimal working example (MWE) and post it as a new question -- maybe referring to this one? Aug 30, 2018 at 20:00
8

The question and answer @benedikt-bauer linked to has since been updated with a new answer which contains a nicer solution:

https://tex.stackexchange.com/a/346281/181287

The biblatex package option date=year should also work.

One may also need labeldate=year as well; or alldates=year and then something like urldate=short

Which should be valid for biblatex version 2.8 (2013) and higher.


Updates: For clarity, here are the relevant (shortened) parts of the manual:

date=year,short,long,terse,comp,ymd,iso default:comp
This option controls the basic format of printed date specifications.

<datetype>date=year,short,long,terse,comp,ymd,iso default:comp
Similar to thedateoption but controls the format of the <datetype>date field in the datamodel.

alldates=year,short,long,terse,comp,iso
Sets the option for all dates in the datamodel to the same value. The date fields in the default data model are date, origdate, eventdate and urldate.

Full manual with more details and explanations of the possible options can be found here: http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf

8
  • this doesn't work for clearing the day, though. Dec 26, 2019 at 0:29
  • What do you mean by 'clearing'? It sets the date format to print only the year (in the output), regardless of whether there is also month and day data available. It doesn't 'clear' anything. Dec 27, 2019 at 7:34
  • Yes. By "cleaning" I mean that it discards the day and, hence, only prints the year and month. Jan 6, 2020 at 13:31
  • Correct, there is no standard date format to print only year and month. But the question was "How to print only year (no day/month)". Jan 7, 2020 at 8:16
  • 1
    @WillemDuncan I think it would make sense to remove the last passage about labeldate having been renamed to labeldateparts. The situation is a bit complicated. And for a while now labeldate is the correct option for this job. What is now the option labeldateparts used to be called labeldate once. Back then an equivalent to labeldate (as it is now) did not exists. When such an option was implemented, the old option needed to be renamed for consistency with other ...date options. ...
    – moewe
    Jan 8, 2020 at 6:55

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.