public function convertToPHPValue($value, AbstractPlatform $platform) { $dtime = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value); if (!$dtime) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString()); } return TimePointFactory::fromDateTime($dtime); }
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value instanceof DateTime) { return $value; } $val = DateTime::createFromFormat($platform->getDateTimeTzFormatString(), $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeTzFormatString()); } return $val; }
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } $val = \Psc\DateTime\Date::parse($platform->getDateFormatString(), $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString()); } return $val; }
/** * {@inheritdoc} */ public function convertToPHPValue($value) { if (empty($value)) { return null; } elseif ($value instanceof \DateTime) { return $value; } $val = \DateTime::createFromFormat('c', $value); if (!$val) { throw ConversionException::conversionFailedFormat($value, $this); } return $val; }