Last updated: 9/21/2026
Converts a datetime value into a string.
Syntax
FORMAT_DATETIME(datetime, format)
Arguments
| Name |
Type |
Description |
Default Value |
| datetime |
timestamp |
A datetime value. |
|
| format |
string |
A format string that is compatible with JodaTime’s pattern: http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html |
|
Examples
| datetime |
format |
Output |
| timestamp '2017-09-25 22:11:00' |
'yyyy/MM/dd HH:mm:ss.SSS' |
`2017/09/25 22:11:00.000` |
| timestamp '2018-03-10 08:12:45' |
'yyyy/MM/dd' |
`2018/03/10` |
| timestamp '2019-10-20 08:55:12.450' |
'HH:mm:ss.SS' |
`08:55:12.45` |
| timestamp '2018-03-10 08:55:12.450' |
'E' |
`Sat` |