formatted 'time' data in calculations

Ross nospam at forMe.thks
Thu Jan 8 10:45:23 EST 2009


Scott David Daniels wrote:
> Ross wrote:
>> There seems to be no shortage of information around on how to use the 
>> time module, for example to use time.ctime() and push it into strftime 
>> and get something nice out the other side, but I haven't found 
>> anything helpful in going the other way.
> 
> As to a paucity of conversion formatting, there is no magic way to take
> everyone's way of putting date and time information in text and convert
> it to unambiguous format, in part because there are too many different
> and contradictory formats.  When I write dates, I know what I intended;
> when I read dates, I guess what the author intended.
> 
> Have you read the entire time module document?  If so, which functions
> in that module take strings as arguments?
> 
>> That is, given some formatted text describing times - is there 
>> something that makes it easy to calculate time differences, or do I 
>> have to index my way through the string pulling out characters, 
>> converting to integers etc...
>>
>> Data is formatted:
>>    t1 = 09:12:10
>>    t2 = 11:22:14
>> I want to calculate tdiff = t2-t1
> 
> Do you do any work yourself?  Show us your attempts.  This looks like
> a trivial exercise.  It seems that for less than four times the effort
> of asking your question you might have found the answer.
> 
> Perhaps I am being too cranky this morning.
> --Scott David Daniels
> Scott.Daniels at Acm.Org


Jeeze, you're quite an ass aren't you?



More information about the Python-list mailing list