Formatting Time

Coates, Steve (ACHE) Steve.Coates at smiths-aerospace.com
Fri Jun 3 06:17:57 EDT 2005


> -----Original Message-----
> From: Ognjen Bezanov [mailto:ognjen at mailshack.com]

> Sent: 03 June 2005 09:30
> To: python-list at python.org
> Subject: Formatting Time
>

> I never thought id need help with such a thing as time

> formatting (admittadly i never did it before) but ok, i guess

> there is a first for everything.
>

> I have a float variable representing seconds, and i want to

> format it like this:
>

> 0:00:00  (h:mm:ss)
>

> Now search as I might i am finding this quite elusive, i had

> a look at the time module but that seems overly complicated

> for this. Anyone got any simple solutions to doing this? cheers!
>


c:\Python24\programs>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> t=36100.0
>>> time.strftime('%H:%M:%S',time.gmtime(t))
'10:01:40'
>>>


Steve

******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege.  If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager.  Please do not copy it for any purpose, or disclose its contents to any other person.  The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company.  The recipient should check this e-mail and any attachments for the presence of viruses.  The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.
******************************************



More information about the Python-list mailing list