_type = self::XMLRPC_TYPE_DATETIME; // 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 $timestamp = (int)$value; } else { $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'); } } $date = date('c', $timestamp); // Convert the timestamp to iso8601 format // Strip out TZ information and dashes $date = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $date); $date = str_replace('-', '', $date); $this->_value = $date; } /** * Return the value of this object as iso8601 dateTime value * * @return int As a Unix timestamp */ public function getValue() { return $this->_value; } }