note 40831 deleted from function.date by derick
| From: | derick@php.net | Date: | Sat, 22 May 2004 13:51:59 +0000 |
| Subject: | note 40831 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69953@lists.php.net to get a copy of this message | ||
Note Submitter: m.fiorentino at interiority d0t com
----
If you have PHP<5.0 and need a W3CDTF Date in a, say, rss feed generated by php, you may use this
snippet of code (mySQL-extract in the $myDate - and the <dc:date></dc:date> is the
example tag (rss 2.0)):
$W3CDTFdate = preg_replace(
"/(\+|\-)([0-9]{2})([0-9]{2})/"
,"$1$2:$3"
, date("O",$myDate));
printf("<dc:date>%sT%s%s</dc:date>"
,date("Y-m-d",$myDate)
,date("H:i:s",$myDate)
,$W3CDTFdate);