public function testDateTime() { $datetime = DateTime::fromFormat('y-m-d', '99-01-01'); $this->assertEquals('1999-01-01 00:00:00', (string) $datetime); }
public function toPhp($value) { if (in_array($value, $this->empty_values, true)) { return ''; } if (is_object($value) && 'photon\\datetime\\DateTime' === get_class($value)) { return $value; } foreach (explode('||', $this->input_formats) as $format) { $date = \photon\datetime\DateTime::fromFormat($format, $value); if (false !== $date) { return $date; } } throw new Invalid($this->error_messages['invalid']); }