I have a date it look like this
JavaScript
x
2
1
2021-12-14T20:32:34Z
2
how can i convert it to someting like this
JavaScript
1
2
1
2021-12-14 20:32
2
Advertisement
Answer
If you want to do this using Pandas, you can use pandas to convert iso date to datetime object then strftime to convert timestamp into string format
JavaScript
1
7
1
import pandas as pd
2
import datetime
3
4
iso_date = '2021-12-14T20:32:34Z'
5
fmt = '%Y-%m-%d %H:%M'
6
pd.to_datetime(iso_date).strftime(fmt)
7
to apply it to a series of dates of DataFrame column you can replace iso_date
with the series of dates and use this code
JavaScript
1
2
1
pd.to_datetime(iso_date).dt.strftime(fmt)
2