Date Time Formats in Python -


what these date-time formats? need convert them same format, check if same. these 2 coming separate data source, need find way make them same format. ideas?

2013-07-12t07:00:00z

2013-07-10t11:00:00.000z

thanks in advance

that .000 micro seconds.

this convert date string of format datetime object.

import datetime d1 = datetime.datetime.strptime("2013-07-12t07:00:00z","%y-%m-%dt%h:%m:%sz") d2 = datetime.datetime.strptime("2013-07-10t11:00:00.000z","%y-%m-%dt%h:%m:%s.%fz") 

then convert them format depending on requirement, using:

new_format = "%y-%m-%d" d1.strftime(new_format) 

Comments