Quite simple newbie question:
What is the object used in python to specify date (and time) in Python?
For instance, to create an object that holds a given date a
>>> import datetime
>>> datetime.datetime.strptime('05/10/09 18:00', '%d/%m/%y %H:%M')
datetime.datetime(2009, 10, 5, 18, 0)
>>> datetime.datetime.today()
datetime.datetime(2009, 10, 5, 21, 3, 55, 827787)
So, you can either use format string to convert to datetime.datetime
object or if you're particularly looking at today's date could use today()
function.