Re: adding leading zeros to a date



John Smith wrote:
> I get three variables from an HTML form. $InDay, $InMonth, and
> $InYear.
>
> $InDate = ($inyear . "-" . $inmonth . "-" . $inday);
>
> This gives me a string named $InDate. Its value is:
> 2005-7-2
>
> I want to have it changed to:
> 2005-07-02
>
> How do I get php to add leading zeros to this date?

Try sprintf()
http://www.php.net/docs.php

--
Andrew @ Rockface\n np: (Winamp is not
active)\nwww.rockface-records.co.uk


.



Relevant Pages