Problem with time

Michael Bentley michael at jedimindworks.com
Thu Mar 22 13:50:52 EDT 2007


>
> 1) i got 2 values from mysql db (fields are "time" type)
> 2) python get it as "<type 'datetime.timedelta'>" (why timedelta???)
> 3) i need to compare 2 fields with actual time ... EG:
> if ArrOutputsAuto[i].TimeFrom >= GNow and ArrOutputsAuto[i].TimeTo  
> <= GNow:
>
> i need actual time, and 2 fields from DB in datetime.time type  
> (correct me
> if i'm wrong) so i can do my test "if time>= ..."
>
> I think i can grab time from DB in string and parse it in
> datetime.time(x,x,x) but its not very optimized
>
> Any idea ?

Just a guess, really.  Is it perchance a timedelta from the epoch?   
If so, comparison should be easy.





More information about the Python-list mailing list