RE: [PHP4BETA] Silly question re formatting dates from a database...

From: Date: Wed, 15 Mar 2000 00:20:58 +0000
Subject: RE: [PHP4BETA] Silly question re formatting dates from a database...
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-12115@lists.php.net to get a copy of this message
> Ok, so this is a really dumb question. Are there any functions > to format a date from a database? I can't find anything obvious > in either the string functions or in the date/time functions. Assuming mysql, you're probably storing dates in the native format; date (0000-00-00) or datetime (0000-00-00 00:00:00). If you want to change a datetime type date to something more friendly, this might work: $date = 2000-03-14 12:00:00; $datearr = Array(); $datetimevals = split("[^[:digit:]]+",$datetimestr,6); while ((list($idx,$field)=each($fields)) && ($idx<count($datetimevals))) { $dta[$field]=intval($vals[$idx]); }

« previous php.version4 (#12115) next »