Skip to content
Advertisement

Most efficient way of transforming a date column to a timestamp column + an hour

I want to know if there is a better way of transforming a date column into a datetime column + 1 hour than the method I am currently using.

Here is my dataframe:

JavaScript

My code:

JavaScript

Which gives the output:

JavaScript

Does anyone know a more efficient way of doing this. Casting to a timestamp twice seems a bit clumsy.

Many thanks.

Advertisement

Answer

you can use something like this:

JavaScript

then you can read more about syntax for intervals, for example, in following blog post from Databricks.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement