pyspark.sql.functions.to_timestamp_ltz#
- pyspark.sql.functions.to_timestamp_ltz(timestamp, format=None)[source]#
Parses the timestamp with the format to a timestamp without time zone. Returns null with invalid input.
New in version 3.5.0.
- Parameters
Examples
>>> df = spark.createDataFrame([("2016-12-31",)], ["e"]) >>> df.select(to_timestamp_ltz(df.e, lit("yyyy-MM-dd")).alias('r')).collect() ... [Row(r=datetime.datetime(2016, 12, 31, 0, 0))]
>>> df = spark.createDataFrame([("2016-12-31",)], ["e"]) >>> df.select(to_timestamp_ltz(df.e).alias('r')).collect() ... [Row(r=datetime.datetime(2016, 12, 31, 0, 0))]