public function db_value() { if (is_array($this->_value)) { return join($this->_config['separator'], $this->_value); } return parent::db_value(); }
protected function _set_value($value) { if (!$value) { return; } // Coming in from $_POST if (is_array($value)) { $this->_date = Arr::overwrite($this->_date, $value); } elseif (is_numeric($value)) { // do nothing } elseif (method_exists('DateTime', 'createFromFormat')) { $date = DateTime::createFromFormat($this->_config['format'], $value); if ($date instanceof DateTime) { $value = $date->format('U'); } else { $value = 0; } } elseif (preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2})/", $value)) { $value = strtotime(date('Y-m-d ') . $value); } else { $value = strtotime($value); } if (is_numeric($value)) { $this->_date = array('year' => date('Y', $value), 'month' => date('n', $value), 'day' => date('j', $value), 'hour' => date('h', $value), 'minute' => date('i', $value), 'second' => date('s', $value), 'meridien' => date('A', $value)); } $value = $this->_value_from_date(); parent::_set_value($value); }