Related to the question I asked here Lyx - change URL appearance in bibtex bibliography, I would like to include something like "Accessed at: Date (dd.mm.yyyy)" in my bibliography. I am not 100 % sure "accessed at" is the right wording in english but this question is more focussed on how to implement this.

I am using Lyx with the Natbib setting and the else-harv biblipgraphy style. I only want the accessed at date for all URLs that are displayed in the bibliography. I have no clue how to start about it, apart from that probably something has to be changed in the .bst file ? Or is there some easiere solution to this.

What it should look like:

URL: www.whatever.com (Accessed at: Date)

I am not sure about the style whether this is common with or without brackets around the accessed at, but I guess either will do.


documentclass[11pt,twoside,english,openright, bibliography=totoc]{scrreprt}
% the following is useful when we have the old nomencl.sty package

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
{scrpage2} &oldpackage
\usepackage[automark, headsepline, footsepline, plainfootsepline]{scrlayer-scrpage}
\renewcommand\nomname{List of Acronyms}


\usepackage {blindtext} 

\usepackage {media9} 
\usepackage[colorlinks=true, urlcolor=black, linkcolor=black,  citecolor=black]{hyperref} 





2 Answers 2


Here is a patch file for the elsarticle-harv style:

--- /usr/share/texmf-dist/bibtex/bst/elsarticle/elsarticle-harv.bst 2016-08-03 08:15:22.000000000 +0200
+++ elsarticle-harv.bst 2016-08-26 11:28:47.873108598 +0200
@@ -67,6 +67,7 @@
+    urldate
@@ -368,7 +369,14 @@
 FUNCTION {write.url}
 { url empty$
     { skip$ }
-    { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
+    {
+      "\newline\urlprefix\url{" url * "}" *
+      urldate empty$
+        'skip$
+        { " (Accessed at " * urldate * ")" * }
+      if$
+      write$ newline$
+    }

Copy your elsarticle-harv-bst to your project and apply this patch. If you are on unix, save the patch in patch.txt and run

cp /usr/share/texmf-dist/bibtex/bst/elsarticle/elsarticle-harv.bst . && patch < patch.txt

This patch extends the write.url function to include the date defined in the field urldate.










  • I am quite new to playing around with the .bst files so what exactly do you mean by appyling the patch? Do I copy in what you posted and if yes where abouts ? Thanks a lot!
    – KiW
    Commented Aug 26, 2016 at 9:54
  • the lines starting with @@ separate different chunks of changes. After the @@ are the line numbers where the changes start (in this case, 67 and 368). Then, every line preceded by a - is deleted in the original version, and you add every line starting with a +. (Lines without a + or - remain unchanged and are for context only.) — edit: on unix, you can use the patch command. Commented Aug 26, 2016 at 9:58
  • Awesome! Thanks a lot - I will give it a try!
    – KiW
    Commented Aug 26, 2016 at 10:00
  • Just out of curiosity it looks like you can run that patch somehow, how would you do that ? EDIT: I am using Windows ;) ... I guess you just answered this one
    – KiW
    Commented Aug 26, 2016 at 10:02

I came here with the same issue as the OP. Meanwhile, the structure of the elsearticle-harv.bst changed. To achieve the same result in version 2.1 as suggested by Martin Nyolt, the variable urldate needs to be added to ENTRY on top of the .bst file:

  { address

And the function print.url (formerly write.url) must be updated (solution copied from Martin):

FUNCTION {print.url}
 {url duplicate$ empty$
   { pop$ "" }
   { new.sentence
     urlprefix "\url{" * swap$  * "}" * urldate empty$

              { " (accessed " * urldate * ")" * }

This should give the desired result.

You must log in to answer this question.

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