- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- docxSettings
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
pdx:addDateAndHour
Inserts the current date and/or hour into the Word document.
Description
Element definition
This element allows the insertion of the current date and/or hour in different formats.
The default format is dd/MM/yyyy H:mm:ss that will render something like 30/01/2014 7:35:48, where:
- dd stands for the day in two digit format,
- MM stands for the month in two digit format,
- yyyy stands for the year in 4 digit format,
- H, mm and ss correspond to hours, minutes and seconds respectively.
This default format can be changed at will through the format option. For example, if we use as format: dd' of 'MMMM' of 'yyyy' at 'HH:mm it will result in something like this: 30 of January of 2014 at 07:35.
The docx standard offers us multiple possibilities that may be explored via this link.
The most usual options are summarized in the following table:
Format Specifier | Description |
---|---|
d | The day of the month: 1 to 31 |
dd | The day of the month: 01 to 31 |
ddd | The day of the month: short name |
dddd | The day of the month: full name |
M | The month of the year: 1 to 12 |
MM | The month of the year: 01 to 12 |
MMM | The month of the year: short name |
MMMM | The month of the year: full name |
y | The year (max. two digits): 0 to 99 |
yy | The year (two digits): 00 to 99 |
yyyy | The year (four digits) |
h | The hour of the day (12 hours clock): 1 to 12 |
hh | The hour of the day (12 hours clock): 01 to 12 |
H | The hour of the day: 1 to 23 |
HH | The hour of the day: 01 to 23 |
m | The minutes: 1 to 59 |
mm | The minutes: 01 to 59 |
s | The seconds: 1 to 59 |
ss | The seconds: 01 to 59 |
tt | AM or PM |
You may also include the date and hour within other element (paragraph, table, header, footer, ...) creating a WordML fragment via the rawWordML option.
Attributes and sub-elements
key | Description |
---|---|
dateFormat | A string with the required date format. The default value is: dd/MM/yyyy H:mm:ss |