Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-17 Thread Asokan Pichai
On Fri, Feb 17, 2012 at 3:16 AM, alain Delon wrote: > userName = raw_input("Enter your name ") >      print "hi " + userName + ". \n " >      seconds = input("Enter the number of seconds since midnight:") >      hours = seconds/3600 >      hoursRemain = hours%60 **

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Alan Gauld
On 17/02/12 01:29, Daryl V wrote: def Int2Digit(integer): if integer < 9: strInteger = "0"+str(integer) else: strInteger = str(integer) return strInteger Or using format strings: def int2Digit(integer): return "%02d" % integer Although this doesn't beha

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Daryl V
You've gotten some really excellent advice about how to approach working with the time format. Here's a chunk of code I use quite a bit. It's probably sub-optimal, but playing with it might help you come up with a solution that works for your application. def Int2Digit(integer): if integer

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Dave Angel
On 02/16/2012 04:46 PM, alain Delon wrote: userName = raw_input("Enter your name ") print "hi " + userName + ". \n " seconds = input("Enter the number of seconds since midnight:") hours = seconds/3600 hoursRemain = hours%60 minutes = hoursReamain/60 secondsRema

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Martin A. Brown
Welcome to the joys of time and date handling. : userName = raw_input("Enter your name ") :      print "hi " + userName + ". \n " :      seconds = input("Enter the number of seconds since midnight:") :      hours = seconds/3600 :      hoursRemain = hours%60 :      minutes = hoursReamain/60 :    

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Prasad, Ramit
>userName = raw_input("Enter your name ") > print "hi " + userName + ". \n " > seconds = input("Enter the number of seconds since midnight:") > hours = seconds/3600 > hoursRemain = hours%60 > minutes = hoursReamain/60 > secondsRemain = minutes%60 > print "hours: " + "min

[Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread alain Delon
userName = raw_input("Enter your name ")      print "hi " + userName + ". \n "      seconds = input("Enter the number of seconds since midnight:")      hours = seconds/3600      hoursRemain = hours%60      minutes = hoursReamain/60      secondsRemain = minutes%60      print "hours: " + "minutes: "