How to convert "Tue Aug 25 10:00:00 2015" this time stamp to "2015-08-25 10:00" in python -


how convert "tue aug 25 10:00:00 2015" time stamp ‍‍"2015-08-25 10:00" in python.

from datetime import datetime date_object = datetime.strptime('jun 1 2005  1:33pm', '%b %d %y %i:%m%p') 

with correct format string, can use datetime.strptime parse string , format again:

import datetime date = datetime.datetime.strptime('tue aug 25 10:00:00 2015', '%a %b %d %h:%m:%s %y') print date.strftime('%y-%m-%d        %h:%m') 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -