DougKruger DougKruger - 3 months ago 28
Python Question

Python datetime to int

I'm returning a datetime object that I wish to convert to int. For example:

print var, type(var)
5 day, 0:00:00 <type 'datetime.timedelta'>


How to return
5
as int?

Answer

In your example you should do var.days

Comments