Skip to content

Commit 5cc0442

Browse files
committed
docs: update user guide to include examples for date_part and extract functions
1 parent dec07e7 commit 5cc0442

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/source/user-guide/common-operations/functions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ Convert to timestamps using :py:func:`~datafusion.functions.to_timestamp`
7878
7979
df.select(f.to_timestamp(col('"Total"')).alias("timestamp"))
8080
81+
Extracting parts of a date using :py:func:`~datafusion.functions.date_part` (alias :py:func:`~datafusion.functions.extract`)
82+
83+
.. ipython:: python
84+
85+
df.select(
86+
f.date_part(literal("month"), col('"event_time"')).alias("month"),
87+
f.extract(literal("day"), col('"event_time"')).alias("day")
88+
)
8189
String
8290
------
8391

0 commit comments

Comments
 (0)