RE: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread Daevid Vincent
> -Original Message- > From: sono...@fannullone.us [mailto:sono...@fannullone.us] > Sent: Thursday, August 20, 2009 3:53 PM > To: Jonathan Tapicer; PHP General List > Subject: Re: [PHP] Displaying 2 digit minutes/seconds > > > On Aug 20, 2009, at 2:34 PM

Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread sono-io
On Aug 20, 2009, at 2:34 PM, Jonathan Tapicer wrote: You can use sprintf or str_pad to fill in with zeros, with sprintf you can do this: echo sprintf('%02d', 5); Thanks, Jonathan! I learned two new functions today! Both work great but I think I like sprintf for this application better

Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread sono-io
On Aug 20, 2009, at 2:38 PM, Ashley Sheridan wrote: What's wrong with using the date() function? You can have it output any sort of format you wish. So, getting a 2 digit time in hours:minutes:seconds you would put: date("H:i:s"); Thanks, Ash. I had tried that before but I couldn't find

Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 14:27 -0700, sono...@fannullone.us wrote: > Hi all, > > I'm using this code to display the current time for our location on > our website: > >date_default_timezone_set('America/Los_Angeles'); > $theTimeIs = getdate(time()); > $theHour =

Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread Jonathan Tapicer
You can use sprintf or str_pad to fill in with zeros, with sprintf you can do this: echo sprintf('%02d', 5); That will print the string "05". Jonathan On Thu, Aug 20, 2009 at 6:27 PM, wrote: > Hi all, > >        I'm using this code to display the current time for our location on > our website: