RE: [PHP] Displaying 2 digit minutes/seconds

From: Date: Fri, 21 Aug 2009 00:12:17 +0000
Subject: RE: [PHP] Displaying 2 digit minutes/seconds
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-297046@lists.php.net to get a copy of this message
> -----Original Message----- > From: sono-io@fannullone.us [mailto:sono-io@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, 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 since > it's more succinct. > > echo sprintf('%02d', $theMinute); Uh. If you MUST do this nonsense, then at least do this instead and not "echo sprintf": printf('%02d', $theMinute);

« previous php.general (#297046) next »