For the Python-Sphinx documentation generator, is there a standard way to automate populating the time and date when the current rendering was built?
Looking in the conf.py
file and at the docs for the RTD theme, I don't see this feature listed.
If you just want to display the date/time somewhere on one page, you can use the |today|
substitution:
Last change: |today|
On my machine the result looks like this:
Last change: 10.07.2019
(German locale, so the date is in the German format)
To change the way the date is formatted, you can set today_fmt
in the configuration, using time.strftime()
's formatting directives.
For example, if you want the date/time to look similar to the format used here on Stack Overflow, set today_fmt
in the config file like this:
today_fmt = '%b %d %y at %H:%M'
...which will change the output of |today|
to this:
Last change: Juli 10 19 at 23:34
Note: according to the docs, %b
should be the "Month as locale’s abbreviated name", so I expected the result to be Jul
instead of Juli
. No idea why I get the full German month name on my machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With