Time display without colon

jam jam at newimage.com
Tue Jun 15 09:23:39 EDT 1999


On Tue, Jun 15, 1999 at 05:56:27PM +0800, John Francis wrote:
> 
> Hi,
> 
> I want to display time without colon separting them
> 
> I am using strftime(format,tuple) function.
> 
> But the display is like this HH:MM:SS
> 
> But I am trying to put it in a table form by extracting from the text
> file
> 
> TIME: HH:MM:SS
> 
> My extraction of each line is based on the colon splitting the field
> name and the value in the field, but my script goes heywire when I have
> the above format (TIME:HH:MM:SS) is there a way to extract this or to
> display TIME in different format.
> 
> Thanking you
> 
> Regards
> John
> 

greetings,

if you are storing the data to be machine readable (in a database or a file
of some sort), why not just use the 'raw' 'time.time()' value, and don't
bother with strftime at all? this way you can display it for the user in any
way they wish, at runtime even, with or without colons, in different
timezones, etc... it's much cleaner and easier to work with, and it (should)
be portable across platforms.

on some systems, time.time() returns a float, so I usually use
'long(time.time())' and use the result in the database or the datafile or
whatever.

hope that helps.

regards,
J
-- 
|| visit gfd <http://quark.newimage.com/> 
|| psa member #293 <http://www.python.org/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




More information about the Python-list mailing list