Re: Convert Date Format?
| From: | Jeff Oien | Date: | Sat, 20 Mar 2004 16:36:39 +0000 |
| Subject: | Re: Convert Date Format? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181035@lists.php.net to get a copy of this message | ||
trlists@clayst.com wrote:
On 20 Mar 2004 Jeff Oien wrote:Can I put that print (sprintf etc. into a variable? Thanks. Jeff OienHow do I convert this 9/8/2001 (which is Month/Day/Year) to this 20010908 (YearMonthDay - with leading zeros)How about: <?php $date = '9/8/2001'; list($mm, $dd, $yy) = explode('/', $date); print(sprintf('%4d%02d%02d', $yy, $mm, $dd)); ?>