Home » Date and Time » Date » Bug #3891
Getting date unresolved
Details
| Request #3891 | Getting date unresolved |
|---|---|
| Submitted | 2005-03-20 10:36 UTC |
| From | raffael at kaywa dot ch |
| Assigned | pajoye |
| Status | Suspended |
| Package | Date |
| PHP Version | 4.3.10 |
| OS | debian |
| Roadmaps | (Not assigned) |
Comments
[2005-03-20 10:36 UTC] raffael at kaywa dot ch
Description:
------------
If I want to have the GMT date '2005-03-20 08:21:00' in timezone 'Europe/Zurich' i can easely transform it like shown below (in "Reproduce code").
But in some cases it would be nice to do not transform it (not changing the time), just adding the timezone info to the date/timestring.
Reproduce code:
---------------
echo datetime2iso8601('2005-03-20 07:21:00', 'GMT', 'Europe/Zurich');
function datetime2iso8601($datetime, $tz_from = NULL, $tz_to = NULL) {
$date =& new Date($datetime);
if (! empty($tz_from)) {
$date->setTZbyID($tz_from);
}
if (! empty($tz_to)) {
$date->convertTZbyID($tz_to);
}
return $date->getDate(DATE_FORMAT_ISO_EXTENDED);
}
Expected result:
----------------
2005-03-20T07:21:00+01:00
(Here everyone knows in which timezone this date/time is)
Actual result:
--------------
2005-03-20T08:21:00
It's converted/transformed to the defined timezone, but no one knows in which.