Re: Displaying 2 digit minutes/seconds
| From: | sono-io at fannullone dot us | Date: | Thu, 20 Aug 2009 22:52:51 +0000 |
| Subject: | Re: Displaying 2 digit minutes/seconds | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297044@lists.php.net to get a copy of this message | ||
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); echo (str_pad($theMinute,2,"0",STR_PAD_LEFT)); Frank