One hour difference in Python
Posted
by Joel
on Stack Overflow
See other posts from Stack Overflow
or by Joel
Published on 2010-04-03T14:00:26Z
Indexed on
2010/04/03
14:03 UTC
Read the original article
Hit count: 302
python
Hello,
I have a datetime.datetime property var. I would like to know if it is less than one hour of the current time. Something like
var.hour<datetime.datetime.today().hour - 1
Problem with the above syntax is that
datetime.datetime.today().hour
returns a number such as "10" and it is not really a date comparation but more of a numbers comparation.
What is the correct syntax?
Thanks!
Joel
© Stack Overflow or respective owner