PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Date and Time » Date » Bug #3891

Getting date unresolved

Details

Request #3891Getting date unresolved
Submitted2005-03-20 10:36 UTC
Fromraffael at kaywa dot ch
Assignedpajoye
StatusSuspended
PackageDate
PHP Version4.3.10
OSdebian
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.