note 6784 modified in date by ronabop
| From: | ronabop@php.net | Date: | Sat, 02 Sep 2000 21:40:05 +0000 |
| Subject: | note 6784 modified in date by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-3955@lists.php.net to get a copy of this message | ||
I have been having some problems taking a date entry from a MySQL database (YYYY-MM-DD) and using
the date() command to format.
I wasnt able to just insert the query output into the date() command because it kept defaulting to
1st jan 1970. The only way I was able to do it was with the following.
$date=$query_disp[date];
$year=substr($date,0,4);
$month=substr($date,5,2);
$day=substr($date,8,2);
$fdate = date("jS F Y",mktime (0,0,0,$month,$day,$year));
http://www.php.net/manual/function.date.php