I'm getting a date as a string, then I'm parsing it to datetime object. Is there any way to check what's is the date format of the object?
Let's say that this is the object that I'm creating:
modified_date = parser.parse("2015-09-01T12:34:15.601+03:00")
How can i print or get the exact date format of this object, i need this in order to verify that it's in the correct format, so I'll be able to to make a diff of today's date and the given date.
parser.parse
do? – Chambersmodified_date = parser.parse("2015-09-01T12:34:15.601+03:00") today = datetime.today() diff_test = modified_date - today
I'm getting an exception:TypeError: can't subtract offset-naive and offset-aware datetimes
It's probably related to the timezone, but i'm not sure – BissetTypeError
is a different question (the answer: use timezone-aware datetime object for the current time e.g.,datetime.now(utc)
) – Molest