import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DateTime.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: DateTime.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,12 +31,11 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
|
||||
/**
|
||||
* Set the value of a dateTime.iso8601 native type
|
||||
*
|
||||
@ -51,20 +50,21 @@ class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
|
||||
// If the value is not numeric, we try to convert it to a timestamp (using the strtotime function)
|
||||
if (is_numeric($value)) { // The value is numeric, we make sure it is an integer
|
||||
$value = (int)$value;
|
||||
$timestamp = (int)$value;
|
||||
} else {
|
||||
$value = strtotime($value);
|
||||
if ($value === false || $value == -1) { // cannot convert the value to a timestamp
|
||||
$timestamp = strtotime($value);
|
||||
if ($timestamp === false || $timestamp == -1) { // cannot convert the value to a timestamp
|
||||
throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp');
|
||||
}
|
||||
}
|
||||
$value = date('c', $value); // Convert the timestamp to iso8601 format
|
||||
|
||||
$date = date('c', $timestamp); // Convert the timestamp to iso8601 format
|
||||
|
||||
// Strip out TZ information and dashes
|
||||
$value = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $value);
|
||||
$value = str_replace('-', '', $value);
|
||||
$date = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $date);
|
||||
$date = str_replace('-', '', $date);
|
||||
|
||||
$this->_value = $value;
|
||||
$this->_value = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,6 +76,4 @@ class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user