protected function _initializeFromObject($date)
{
if ($date instanceof DateTime) {
$this->_year = (int) $date->format('Y');
$this->_month = (int) $date->format('m');
$this->_mday = (int) $date->format('d');
$this->_hour = (int) $date->format('H');
$this->_min = (int) $date->format('i');
$this->_sec = (int) $date->format('s');
$this->_initializeTimezone($date->getTimezone()->getName());
} else {
$is_horde_date = $date instanceof Horde_Date;
foreach (array('year', 'month', 'mday', 'hour', 'min', 'sec') as $key) {
if ($is_horde_date || isset($date->{$key})) {
$this->{'_' . $key} = (int) $date->{$key};
}
}
if (!$is_horde_date) {
$this->_correct();
} else {
$this->_initializeTimezone($date->timezone);
}
}
}