added very basic timezone support to IXR_Date

git-svn-id: http://svn.automattic.com/wordpress/trunk@1564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2004-08-26 12:40:48 +00:00
parent 130040426b
commit 9bf7b66e00
1 changed files with 4 additions and 2 deletions

View File

@ -602,6 +602,7 @@ class IXR_Date {
var $hour; var $hour;
var $minute; var $minute;
var $second; var $second;
var $timezone;
function IXR_Date($time) { function IXR_Date($time) {
// $time can be a PHP timestamp or an ISO one // $time can be a PHP timestamp or an ISO one
if (is_numeric($time)) { if (is_numeric($time)) {
@ -620,14 +621,15 @@ class IXR_Date {
} }
function parseIso($iso) { function parseIso($iso) {
$this->year = substr($iso, 0, 4); $this->year = substr($iso, 0, 4);
$this->month = substr($iso, 4, 2); $this->month = substr($iso, 4, 2);
$this->day = substr($iso, 6, 2); $this->day = substr($iso, 6, 2);
$this->hour = substr($iso, 9, 2); $this->hour = substr($iso, 9, 2);
$this->minute = substr($iso, 12, 2); $this->minute = substr($iso, 12, 2);
$this->second = substr($iso, 15, 2); $this->second = substr($iso, 15, 2);
$this->timezone = substr($iso, 17);
} }
function getIso() { function getIso() {
return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
} }
function getXml() { function getXml() {
return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';