Re: Convert Date Format?

From: 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:
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)); ?>
Can I put that print (sprintf etc. into a variable? Thanks. Jeff Oien

« previous php.general (#181035) next »