Description | The |
Syntax | TO_TEXT( TO_TEXT( |
Variables
value: The value you want to convert to text. This can be a datetime, number, or any other compatible data type.format: (Optional) A parameter specifying the desired text format for the datetimes or the number. If not provided, a default format is used.
Date and Time Formatting
When formatting datetimes, Savant uses pattern strings where letters represent parts of the date/time and other characters are treated as literal text.
Quick reference patterns
What you want | Pattern | Example output |
Standard date |
|
|
Standard datetime |
|
|
US date style |
|
|
European date style |
|
|
Month and year only |
|
|
Readable date |
|
|
Readable with weekday |
|
|
Common Tokens
Category | Tokens | Meaning |
Date |
| Year (4-digit, 2-digit) |
Date |
| Month (1–2 digit number, 2-digit number, short name, full name) |
Date |
| Day of month (1–2 digit number, 2-digit number) |
Date |
| Weekday (short name, full name) |
Date |
| Quarter |
Time |
| Hour, 24-hour clock (0–23, 2-digit) |
Time |
| Hour, 12-hour clock (1–12, 2-digit) |
Time |
| Minute (1–2 digit number, 2-digit number) |
Time |
| Second (1–2 digit number, 2-digit number) |
Time |
| AM/PM marker |
Literal Text
Non-pattern characters (dashes, slashes, colons, spaces) appear as written. If you need to include text that could be mistaken for pattern letters, wrap it in single quotes (ex: 'T', 'at').
Examples
Use Case | Formula | Example Output |
Basic conversion (no format) |
|
|
Date only |
|
|
Datetime (24-hour) |
|
|
Readable datetime (12-hour) |
|
|
Timestamp for filenames |
|
|
Gotchas
Case sensitivity matters
Uppercase and lowercase letters mean different things – mixing them up is a common source of bugs.
Use
yyyyfor calendar year – avoidYYYYunless you specifically need week-based year behavior.Use
ddfor day of month – avoidDDunless you specifically need day of year.MMis month,mmis minute.
12-hour vs 24-hour time
Prefer
HH(24-hour) for data processingUse
hhwithafor user-facing displays
