Re: adding leading zeros to a date
- From: "Andrew @ Rockface" <andrew@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Apr 2005 17:03:44 +0000 (UTC)
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
.
- Follow-Ups:
- Re: adding leading zeros to a date
- From: ZeldorBlat
- Re: adding leading zeros to a date
- References:
- adding leading zeros to a date
- From: John Smith
- adding leading zeros to a date
- Prev by Date: adding leading zeros to a date
- Next by Date: Re: Cookies bug with IE
- Previous by thread: adding leading zeros to a date
- Next by thread: Re: adding leading zeros to a date
- Index(es):
Relevant Pages
|