Skip to content
Advertisement

how to change datetime format column that contains a string

I’ve a data frame contains a column (Start Shift) and it has different data types (Datetime/string), What i need is to change the datetime format to be time format only and keep the string without any change, i used the below code to solve this issue but i can’t find a way to apply this change in the data frame as when i trying to load the data frame after this change i found nothing has been changed.

The code that i used:-

JavaScript

The Data Frame is:-

JavaScript

enter image description here

The Data Frame that i expected to found:-

JavaScript

Advertisement

Answer

You can try to cast the dates into datetime first:

JavaScript

Update: This can be applied to multiple columns using the following function:

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