[Tex/LaTex] Biblatex: Adding time information to “online” field and a label in front of url

biblatexonlineurls

I am trying to add some "time" information to my online-fields in biblatex. I tried to use the note entry, but that won't work as intended.
Right now I got the following:

\documentclass[a4paper, 
    oneside, 
    12pt, 
    bibliography=totocnumbered, 
    listof=totocnumbered
]{scrreprt}
\usepackage[english, ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[utf8]{inputenc}
\usepackage[automark]{scrpage2}

\usepackage[backend=biber, style=authoryear, urldate=comp, dateabbrev=false]{biblatex}
\bibliography{source}
\DeclareFieldFormat{url}{\newline\url{#1}}
\DeclareFieldFormat{urldate}{\addcomma\space#1}



\begin{document}
Latex is science \parencite{stack}

\printbibliography

\end{document}

And the file source.bib looks like:

@online{stack,
    author = {Stack},
    title = {Why Latex is science},
    month = {april},
    year = 2012,
    url = {www.tex.stackexchange.com},
    urldate = {2013-04-29},
    note = "14.44 Uhr",
}

This currently gives me the following output:

Current output

What I really need right now is this:

Stack (2012): Why Latex is science, URL: www.tex.stackexchange.com,
29.4.2013, 14.44 Uhr.

So basically:

  • Add time information at the end
  • Add "URL: "-label in front of the actual url
  • change some periods to colon or comma

Any help is appreciated!


Update 1

So I am almost there. The time is added (thanks to Guido). I only need some more field formating. The code part looks like this:

\documentclass[a4paper, 
oneside, 
12pt, 
bibliography=totocnumbered, 
listof=totocnumbered
]{scrreprt}
\usepackage[english, ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[automark]{scrpage2}
\usepackage[]{url}


\usepackage[backend=biber, style=authoryear, urldate=comp, dateabbrev=false]{biblatex}
\bibliography{source}
%\begin{filecontents}{biblatex-dm.cfg}
%    \DeclareDatamodelFields[type=field,datatype=literal,skipout=false]{urltime}
%\end{filecontents}
\DeclareFieldFormat{date}{#1}    % Not sure with this one
\DeclareFieldFormat{title}{#1\addcomma}
\DeclareFieldFormat{url}{\newline\bibstring{URL}\addcolon\addspace\url{#1}}
\DeclareFieldFormat{urltime}{#1}
\DeclareFieldFormat{urldate}{\addcomma\space#1\addcomma\addspace\printfield{urltime}}



\begin{document}
Latex is science \parencite{stack}

\printbibliography

\end{document}

And here's a colorful visualization of the way it should be in the end:

how it needs to be in the end

Best Answer

Modified answer for UPDATE 1

It is better not to use note. Biblatex offers the opportunity to create new fields, so I would create a new field for the url time (urltime).

This can be done with

\begin{filecontents}{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field,datatype=literal,skipout=false]{urltime}
\end{filecontents}

then for the formatting of the URL and related information a possibility is to use the following format instructions:

\DeclareFieldFormat{url}{\newline\bibstring[\MakeUppercase]{url}\addcolon\addspace\url{#1}}
\DeclareFieldFormat{urltime}{#1}
\DeclareFieldFormat{urldate}{%
  \iffieldundef{urlday}
    {}
    {\stripzeros{\thefield{urlday}}\adddot}%
  \iffieldundef{urlmonth}
    {}
    {\stripzeros{\thefield{urlmonth}}\adddot}%
  \printfield{urlyear}%
}

\renewbibmacro{url+urldate}{%
  \printfield{url}\setunit{\addcomma\addspace}
  \printurldate\addcomma\addspace
  \printfield{urltime}}

To change the standard punctuation, from . (dot) to . (comma), one can use

\renewcommand{\newunitpunct}{\adddot}

For the . after the year,

\renewcommand{\labelnamepunct}{\addcomma} 

Finally to remove the month from the label, a possible solution is to use

\AtEveryBibitem{\clearfield{month}} 

Entries in the .bib files now can contain the new urltime field.

@online{stack,
    author = {Stack},
    title = {Why {\LaTeX} is science},
    month = {april},
    year = 2012,
    url = {www.tex.stackexchange.com},
    urldate = {2013-04-29},
    urltime = "14.44 Uhr",
} 

Please notice how properly write LaTeX in a .bib file. In general it is best to enclose whole words in { } of single letters to preserve their capitalisation (and then kerning by enclosing the whole word).

enter image description here