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
Post a Comment