You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description = "Returns a string representation of a date, time, timestamp or duration based on a [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). Unlike the PostgreSQL equivalent of this function numerical formatting is not supported.",
41
+
syntax_example = "to_char(expression, format)",
42
+
sql_example = r#"```sql
43
+
> select to_char('2023-03-01'::date, '%d-%m-%Y');
44
+
+----------------------------------------------+
45
+
| to_char(Utf8("2023-03-01"),Utf8("%d-%m-%Y")) |
46
+
+----------------------------------------------+
47
+
| 01-03-2023 |
48
+
+----------------------------------------------+
49
+
```
50
+
51
+
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/to_char.rs)
52
+
"#,
53
+
argument(
54
+
name = "expression",
55
+
description = "Expression to operate on. Can be a constant, column, or function that results in a date, time, timestamp or duration."
56
+
),
57
+
argument(
58
+
name = "format",
59
+
description = "A [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) string to use to convert the expression."
60
+
),
61
+
argument(
62
+
name = "day",
63
+
description = "Day to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators."
64
+
)
65
+
)]
38
66
#[derive(Debug)]
39
67
pubstructToCharFunc{
40
68
signature:Signature,
@@ -143,42 +171,10 @@ impl ScalarUDFImpl for ToCharFunc {
"Returns a string representation of a date, time, timestamp or duration based on a [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). Unlike the PostgreSQL equivalent of this function numerical formatting is not supported.",
157
-
"to_char(expression, format)")
158
-
.with_argument(
159
-
"expression",
160
-
" Expression to operate on. Can be a constant, column, or function that results in a date, time, timestamp or duration."
161
-
)
162
-
.with_argument(
163
-
"format",
164
-
"A [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) string to use to convert the expression.",
165
-
)
166
-
.with_argument("day","Day to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators.")
167
-
.with_sql_example(r#"```sql
168
-
> select to_char('2023-03-01'::date, '%d-%m-%Y');
169
-
+----------------------------------------------+
170
-
| to_char(Utf8("2023-03-01"),Utf8("%d-%m-%Y")) |
171
-
+----------------------------------------------+
172
-
| 01-03-2023 |
173
-
+----------------------------------------------+
174
-
```
175
-
176
-
Additional examples can be found [here](https://github.com/apache/datafusion/blob/main/datafusion-examples/examples/to_char.rs)
Copy file name to clipboardexpand all lines: datafusion/functions/src/datetime/to_date.rs
+17-15
Original file line number
Diff line number
Diff line change
@@ -38,21 +38,23 @@ Returns the corresponding date.
38
38
39
39
Note: `to_date` returns Date32, which represents its values as the number of days since unix epoch(`1970-01-01`) stored as signed 32 bit value. The largest supported date value is `9999-12-31`.",
0 commit comments