protected function getDbDate() { if (!($s = $this->_control->getText())) { return NULL; } $formatter = new TSimpleDateFormatter($this->_dateFormat); $formatterDb = new TSimpleDateFormatter('yyyy-MM-dd'); if (($ts = $formatter->parse($s)) == false) { throw new TInvalidDataTypeException('Invalid date input. (The validator should have caught that already)'); } //TODO Put to messages $dbDate = $formatterDb->format($ts); if (!$dbDate) { throw new TInvalidDataTypeException('Invalid date input. (The validator should have caught that already)'); } //TODO Put to messages return $dbDate; }