diff options
Diffstat (limited to 'inc/IXR_Library.php')
-rw-r--r-- | inc/IXR_Library.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index b82952d74..2fb7dfe68 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -615,12 +615,14 @@ class IXR_Date { $this->second = gmdate('s', $timestamp); } function parseIso($iso) { - $this->year = substr($iso, 0, 4); - $this->month = substr($iso, 5, 2); - $this->day = substr($iso, 8, 2); - $this->hour = substr($iso, 11, 2); - $this->minute = substr($iso, 14, 2); - $this->second = substr($iso, 17, 2); + if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/',$iso,$match)){ + $this->year = (int) $match[1]; + $this->month = (int) $match[2]; + $this->day = (int) $match[3]; + $this->hour = (int) $match[5]; + $this->minute = (int) $match[6]; + $this->second = (int) $match[8]; + } } function getIso() { return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; |