Returns the current timestamp (UTC) with microsecond precision.
Returns:
| Name | Type | Description |
Expression | Expression | a Timestamp[us] expression containing the current datetime, broadcast to every row. |
Examples:
| >>> import daft
>>> from daft.functions import current_timestamp
>>> df = daft.from_pydict({"x": [1, 2, 3]})
>>> df = df.with_column("now", current_timestamp())
>>> df.schema()["now"].dtype == daft.DataType.timestamp("us")
|
Source code in daft/functions/datetime.py
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269 | def current_timestamp() -> Expression:
"""Returns the current timestamp (UTC) with microsecond precision.
Returns:
Expression: a Timestamp[us] expression containing the current datetime, broadcast to every row.
Examples:
>>> import daft
>>> from daft.functions import current_timestamp
>>> df = daft.from_pydict({"x": [1, 2, 3]})
>>> df = df.with_column("now", current_timestamp())
>>> df.schema()["now"].dtype == daft.DataType.timestamp("us")
True
"""
return Expression._call_builtin_scalar_fn("current_timestamp")
|