How to convert a date to text
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Turn a real date into a text string in a format you control — for filenames, labels, exports, or joining.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 2026-07-21 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
TEXT — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to abbreviate large numbers as K and M
- How to add leading zeros to a number
- How to concatenate a date with text (without getting a number)
- How to convert 12-hour text times to 24-hour
- How to convert minutes to hours and minutes