how to convert unix timestamp with z to date time in python -
how to convert unix timestamp with z to date time in python -
how convert timestamp '20141031131429z' 31 oct 2014 in python
>>>datetime.datetime.strptime( "20141031131429z", "%y%m%d%h%m%s%z" ) the above code gives me error shown below:
valueerror: time info '20141031131429z' not match format '%y%m%d%h%m%s%z'
remove % in front end of z:
d = datetime.datetime.strptime("20141031131429z", "%y%m%d%h%m%sz" ) print(d.strftime("%d %b %y")) output:
31 oct 2014 set documentation strftime() , strptime() behavior.
python python-2.7 datetime
Comments
Post a Comment