Description
Formats a date to a string. If a tz identifier is provided, uses that time zone instead of the local time zone.
Available In
- Apps
- Automations
- Analytics
- Functions
Syntax
DATETIMETOTEXT(date: Datetime or Date, format: Text, timezone?: Text)
Example
DATETIMETOTEXT(@App Info.Current Date and Time, 'MMM DD YYYY', 'America/New_York') = Jan 01 2019
Limitations
- DATETIMETOTEXT formats day and month names in the local station's language. The same expression returns different text on stations set to different languages. For example, it returns "Monday" on an English station and "lundi" on a French station. Don't rely on the output matching a fixed string in one language.
- In Analytics, DATETIMETOTEXT doesn't use moment.js. These expressions are converted to SQL, so Analytics has limited support for moment.js formatting tokens, and the
Wtoken returns an incorrect value. Apps, Automations, and Functions support the full moment.js token set.
Additional Information
Formatting: devhints.io/moment
