how can i convert YYYY-MM-DD hh:mm:ss format to integer in python? for example 2014-02-12 20:51:14 -> to integer.
i know how to convert only hh:mm:ss but not
I think I have a shortcut for that:
# Importing datetime. from datetime import datetime # Creating a datetime object so we can test. a = datetime.now() # Converting a to string in the desired format (YYYYMMDD) using strftime # and then to int. a = int(a.strftime('%Y%m%d'))