note 12464 deleted from function.date by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 00:57:11 +0000 |
| Subject: | note 12464 deleted from function.date by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20078@lists.php.net to get a copy of this message | ||
Useful tidbit for converting a nice SQL storable date into something readily human readable.
given that $sqldate equals something like "2001-04-14" (YYYY-MM-DD) then the following
code will output something like:
Saturday, April 14 2001
---------------------------------
$dates = explode ("-", $sqldate);
$temp = 0;
$humandate = strftime("%A, %B %d %Y",mktime(0,0,0,$dates[1],$dates[2]+$temp,$dates[0]));
PRINT "$humandate";
-------------------------------
replace the "-" in the explode statement with whatever delimiter you used in your date
format and look at the manual page for the strftime function to see the end output instructions..
*Some code found on this board so I though it appropriate to give some back