Format date with function in LibreOffice

Estimated reading time of this article: 1 minute

How to format the current date using a LibreOffice function?

TEXT(NOW();"JJJJMMTT\_HHMM")

Attention: The format string is locale dependent.

TEXT(NOW();"YYYYMMDD\_HHMM")

The format string for month and minutes are both MM. LibreOffice interprets MM depending on the context, ie. are before or after hours, seconds, years or days.

Such a function can be used to create date based file names.

Example:

="file_prefix_" & A1 & "_" & TEXT(NOW();"JJJJMMTT\_HHMM") & ".suffix"