1 %% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
2 %% This file is in the public domain.
7 I often find it useful to include a date on printed music, so that I
8 can see if I'm using the latest version, or tell someone else that he
9 should only use the version after a certain date. A simple solution is
10 to enter the date manually to the @code{.ly} file. But that's very
11 error prone. It's easy to forget updating the date. So i thought it
12 would be useful if you can add the date on which the PDF file is
13 generated automatically. I did't figure it out myself, but I asked on
14 lilypond-user@@gnu.org. And guess what? Someone came with an excellent
15 solution! So thank you very much Toine Schreurs for sending this
16 solution to the user mailing list. I post it here for future reference.
18 The solution is to use two scheme functions called @code{strftime} and
19 @code{localtime}, as shown in the snippet. It is a very flexible
20 solution, you can format the date just as you like it by adapting the
21 @code{\"%d-%m-%Y\"} string. See the Guile documentation for more
22 details on this format string: Formatting Calendar Time.
26 % first, define a variable to hold the formatted date:
27 date = #(strftime "%d-%m-%Y" (localtime (current-time)))
29 % use it in the title block:
31 title = "Including the date!"
40 % and use it in a \markup block: