Saturday 15 September 2012

Python time comparison -


How do I compare time in Python?

I think the date can be computed and there is also "TimeDelta", but I am struggling to find out the current time (date time.Nan ()) before Check the date, regardless of the date, compared to a specified time (like 8 o'clock).

You can not compare a specific time (like "now ") Against an unpublished recurring event (8 days happens every day).

You can see that now today's is before or after 8 o'clock:

  & gt; & Gt; & Gt; Import Date Time & gt; & Gt; & Gt; Now = datetime.datetime.now () & gt; & Gt; & Gt; Today at 8 o'clock = now Location (hour = 8, min = 0, second = 0, microcond = 0)> gt; & Gt; & Gt; Now & lt; Today 8:00 truth & gt; & Gt; & Gt; Now == today 8am false & gt; & Gt; & Gt; Now & gt; Today is wrong 8:00  

No comments:

Post a Comment