The %%date macro expands to the current date and time.
It is very useful on the document headers or footer, to register the
date when the document was generated. To expand to the source document
last modification time, see the %%mtime macro
.
This macros accepts several formatting directives. The full list can be found in the Python site. Here are the most commonly used:
| Directive | Description |
|---|---|
| %a | Locale's abbreviated weekday name. |
| %A | Locale's full weekday name. |
| %b | Locale's abbreviated month name. |
| %B | Locale's full month name. |
| %c | Locale's appropriate date and time representation. |
| %d | Day of the month as a decimal number [01,31]. |
| %H | Hour (24-hour clock) as a decimal number [00,23]. |
| %I | Hour (12-hour clock) as a decimal number [01,12]. |
| %m | Month as a decimal number [01,12]. |
| %M | Minute as a decimal number [00,59]. |
| %p | Locale's equivalent of either AM or PM. |
| %S | Second as a decimal number [00,61]. (1) |
| %x | Locale's appropriate date representation. |
| %X | Locale's appropriate time representation. |
| %y | Year without century as a decimal number [00,99]. |
| %Y | Year with century as a decimal number. |
| %% | A literal "%" character. |
Examples:
| Macro | --> | Results for on 2007, Nov 11 at 17:41 |
|---|---|---|
| %%date(Converted on: %c) | --> | Converted on: Sun Nov 11 17:41:07 2007 |
| %%date(%Y-%m-%d) | --> | 2007-11-11 |
| %%date(%I:%M %p) | --> | 05:41 PM |
| %%date(Today is %A, on %B.) | --> | Today is Sunday, on November. |