Skip to main content

Insert Date/Time

Plugin alias: insertdatetime

editor42.init({
plugins: 'insertdatetime'
});

Inserts the current date and/or time into the editor content using configurable strftime-style format patterns (%Y, %m, %d, %H, %M, %S, etc.). Can optionally wrap the value in an HTML <time> element with a machine-readable datetime attribute.

Options

OptionTypeDefaultDescription
insertdatetime_dateformatstring'%Y-%m-%d'Default date format.
insertdatetime_timeformatstring'%H:%M:%S'Default time format.
insertdatetime_formatsstring[]['%H:%M:%S', '%Y-%m-%d', '%I:%M:%S %p', '%D']Formats shown in the dropdown.
insertdatetime_elementbooleanfalseWrap inserted value in a <time> element.

Commands

CommandDescription
editor42InsertDateInserts the current date.
editor42InsertTimeInserts the current time.

Toolbar buttons

NameTypeDescription
insertdatetimeSplit buttonMain action uses last-selected format; dropdown shows all formats.
NameTypeDescription
insertdatetimeNested menu itemSubmenu of all formats.