← All how-to recipes

How to convert a date to text

✓ Verified in LibreOffice 25.8.7.3

Turn a real date into a text string in a format you control — for filenames, labels, exports, or joining.

The formula

AppFormulaNotes
Excel=TEXT(A2,"yyyy-mm-dd")The format code controls the output: "mmmm d, yyyy" -> July 21, 2026; "ddd" -> Tue.
Google Sheets=TEXT(A2,"yyyy-mm-dd")Identical.
LibreOffice Calc=TEXT(A2,"YYYY-MM-DD")Identical (format codes are case-insensitive here).

How it works

TEXT renders the date's underlying serial number as a string using the format code you give it, so July 21, 2026 becomes the text "2026-07-21". Unlike changing the cell format (which only affects display), the result here is genuinely text — it can be concatenated, used in a filename, or exported, but it won't sort or calculate as a date anymore. Pick the format to match your need: "yyyymmdd" for sortable filenames, "mmmm yyyy" for report headers. The reverse (text back to a real date) is DATEVALUE.

Verified, not just documented

We ran =TEXT(DATE(2026,7,21),"YYYY-MM-DD") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 2026-07-21 — exactly the expected result. Every formula here is confirmed by actually executing it.