Re: Convert Date Format?

From: Date: Sat, 20 Mar 2004 16:24:14 +0000
Subject: Re: Convert Date Format?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181033@lists.php.net to get a copy of this message
On 20 Mar 2004 Jeff Oien wrote: > How 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)); ?> -- Tom

« previous php.general (#181033) next »