daft.functions.to_date#
to_date #
to_date(expr: Expression, format: str) -> Expression
Converts a string to a date using the specified format.
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Expression | a Date expression which is parsed by given format |
Note
The format must be a valid date format string. See: https://docs.rs/chrono/latest/chrono/format/strftime/index.html
Examples:
1 2 3 4 5 | |
╭────────────┬────────────╮
│ x ┆ date │
│ --- ┆ --- │
│ String ┆ Date │
╞════════════╪════════════╡
│ 2021-01-01 ┆ 2021-01-01 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2021-01-02 ┆ 2021-01-02 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ None ┆ None │
╰────────────┴────────────╯
(Showing first 3 of 3 rows) Source code in daft/functions/datetime.py
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | |