@@ -94,7 +94,7 @@ The following SQL functions are supported. For Window function, see the separate
94
94
| ` substring(string s, int start, int length) ` | string | Extracts a substring from a string, starting at a given position and for a specified length. |
95
95
| ` extract(field from timestamp/interval) ` | numeric | Extracts a part of a date or time field (such as year or month) from a timestamp or interval. |
96
96
| ` to_timestamp(string timestamp, string format) ` | timestamp | Converts a string to a timestamp according to the given format. |
97
- | ` to_char(timestamp t / interval i / numeric n, format f) ` | string | Converts a timestamp, interval, or numeric value to a string using a format.|
97
+ | ` to_char(timestamp t, string format) ` | string | Converts a timestamp to a string according to the given format. |
98
98
| ` date_trunc(string unit, timestamp t) ` | timestamp | Truncates a timestamp to a specified precision based on the provided unit. |
99
99
| ` regexp_like(string s, pattern p) ` | boolean | Evaluates if a string matches a regular expression pattern. |
100
100
@@ -258,6 +258,25 @@ SELECT
258
258
{{< /code-block >}}
259
259
260
260
### ` TO_CHAR `
261
+
262
+ Supported patterns for date/time formatting:
263
+ | Pattern | Description |
264
+ | ----------- | ------------------------------------ |
265
+ | ` YYYY ` | year (4 digits) |
266
+ | ` YY ` | year (2 digits) |
267
+ | ` MM ` | month number (01 - 12) |
268
+ | ` DD ` | day of month (01 - 31) |
269
+ | ` HH24 ` | hour of day (00 - 23) |
270
+ | ` HH12 ` | hour of day (01 - 12) |
271
+ | ` HH ` | hour of day (01 - 12) |
272
+ | ` MI ` | minute (00 - 59) |
273
+ | ` SS ` | second (00 - 59) |
274
+ | ` MS ` | millisecond (000 - 999) |
275
+ | ` TZ ` | time-zone abbreviation |
276
+ | ` OF ` | time-zone offset from UTC |
277
+ | ` AM ` / ` am ` | meridiem indicator (without periods) |
278
+ | ` PM ` / ` pm ` | meridiem indicator (without periods) |
279
+
261
280
{{< code-block lang="sql" >}}
262
281
SELECT
263
282
to_char(order_date, 'MM-DD-YYYY') AS formatted_date
0 commit comments