note 42450 added to function.date
| From: | jseng at pobox dot org dot sg | Date: | Mon, 17 May 2004 10:06:49 +0000 |
| Subject: | note 42450 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69706@lists.php.net to get a copy of this message | ||
To use the ISO 8601 date spec in PHP <5, you *cannot* simply use the string format
"Y-m-d\TH:i:sO" because the timezone format in ISO 8601 is in the format +XX:XX not +XXXX
returned by 'O'
Use this function instead:
function iso8601_date($time) {
$tzd = date('O',$time);
$tzd = $tzd[0] . str_pad((int) ($tzd/100),2,"0",STR_PAD_LEFT) .
str_pad((int) ($tzd%100),2,"0",STR_PAD_LEFT);
$date = date('Y-m-d\TG:i:s',$time).$tzd; return $date;
}
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42450
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42450&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42450&report=yes
Search -- http://master.php.net/manage/user-notes.php