DougKruger
DougKruger

Reputation: 4624

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?

Upvotes: 0

Views: 205

Answers (1)

Andrii Zarubin
Andrii Zarubin

Reputation: 2255

In your example you should do var.days

Upvotes: 2

Related Questions