[Tutor] time comparison question

Liam Clarke cyresse at gmail.com
Sat Nov 27 04:53:47 CET 2004


Eep, you're right Brian, mea culpa.


On Fri, 26 Nov 2004 14:16:40 -0500, Brian van den Broek
<bvande at po-box.mcgill.ca> wrote:
> Anna Ravenscroft said unto the world upon 2004-11-26 08:19:
> > Brian van den Broek wrote:
> >
> >> Hi all,
> >>
> >> I'm trying to build some Python 2.3.4 code which will determine if the
> >> actual time when it is run is after the date and time specified in
> >> some data. I want my data to be able to specify the target date/time
> >> in a various levels of detail. I.e., I want 2004-11-28 13:25,
> >> 2004-11-28, 11-28, 11-28 13:25 to all be accepted.
> 
> Hi all,
> 
> thanks to Anna, G. Rodrigues, and Liam for the replies. The code that
> was posted using datetime didn't seem so scary after all :-)
> 
> As evidence accrues, I think I am going to just have to gather myself
> together and surmount the aversion to classes and other aspects of OOP.
> At least in this case, code has shown it isn't too tricky.
> 
> One minor quibble with something Liam posted. Of struct_time objects he
> said:
> 
> > The 9 value tuple has year to microsecond, and day of the week
> > contained, so you can use it if you wish.
> 
> For future googlers, my understanding is that the first 6 elements of a
> struct_time tuple are the date and time from year down to the second
> (microseconds playing no role), and the last three are weekday, day of
> year, and DST flag.
> 
> Anyway, having read the replies, it looks like my problem is solved.
> Thanks folks!
> 
> 
> 
> Best to all,
> 
> Brian vdB
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list