public function datestamp() { if ($this->_year >= 1970 && $this->_year < 2038) { return mktime(0, 0, 0, $this->_month, $this->_mday, $this->_year); } $date = new DateTime($this->format('Y-m-d')); return $date->format('U'); }
/** * Saves the txt_datavalue or int_datavalue depending on context. * * Folds special data types into a serializable, preferably search-friendly * format. */ public function setDataValue($value) { /* These field-specific handlers should better be delegated to field * definitions. */ switch ($this->property->datatype) { case 'date': case 'datetime': case 'hourminutesecond': case 'monthdayyear': case 'monthyear': case 'time': if (is_array($value)) { // Directly passing the array makes funny breakage :( $dt = new Horde_Date(); foreach ($value as $marker => $content) { if (strlen($content)) { $dt->{$marker} = $content; } } $value = $dt->datestamp(); } break; case 'image': $value = $value['hash']; break; } return $this->txt_datavalue = $value; }