Re: how to format a date variable

From: Date: Fri, 18 May 2001 02:48:40 +0000
Subject: Re: how to format a date variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53373@lists.php.net to get a copy of this message
Carlos Fernando Scheidecker Antunes wrote: > If I issue the comand date(d."/".m."/".Y." > ".H.":".i.":".s) > I get the Today's date and time formated accordingly. Don't you want to put the letters inside the quotes? > So what I need is to format variable $OrderDate to Day/Month/year Hour:Min:Sec.. How can I do > it the same way as the Date() function above? I guess $OrderDate is in the DATETIME format and not the DATE, in which case you'd only have, well, the date and not the time. If this is the case, then the format of the $OrderDate string will be 'YYYY-MM-DD HH:MM:SS'. I haven't tried, but this should work: <? list($year, $month, $day, $hours, $mins, $secs) = split('[- :]', $OrderDate); ?> There's probably heaps of ways to do this, but this is (hopefully) one. <http://www.php.net/manual/en/function.split.php> --Fredrik

« previous php.general (#53373) next »