DougKruger DougKruger - 1 year ago 198
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
as int?

Answer Source

In your example you should do var.days

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download