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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to