Apache Zeta Components Manual :: File Source for date.php
Source for file date.php
Documentation is available at date.php
* File containing the ezcFeedDateElement class.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @version //autogentag//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* Class defining a date element.
* @property DateTime $date
* The date stored as a DateTime object. An integer timestamp
* or a formatted string date can be assigned to the $date
* property, and it will be converted to a DateTime object.
* If the conversion was not successful, the current date
* is assigned to the property.
* @version //autogentag//
* Sets the property $name to $value.
* @param string $name The property name
* @param mixed $value The property value
public function __set( $name, $value )
$this->properties[$name] =
$this->prepareDate( $value );
parent::__set( $name, $value );
* Returns the value of property $name.
* @param string $name The property name
public function __get( $name )
return parent::__get( $name );
* Returns if the property $name is set.
* @param string $name The property name
public function __isset( $name )
return parent::__isset( $name );
* Returns the provided $date (timestamp, string or DateTime object) as a
* It preserves the timezone if $date contained timezone information.
* @param mixed $date A date specified as a timestamp, string or DateTime object
private function prepareDate( $date )
return new DateTime( "@{$date}" );
else if ( $date instanceof
DateTime )
$d =
new DateTime( $date );