You are here

public function DateTimeFormatterStrategy::extract in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-hydrator/src/Strategy/DateTimeFormatterStrategy.php \Zend\Hydrator\Strategy\DateTimeFormatterStrategy::extract()

Converts to date time string

Parameters

mixed|DateTime $value:

Return value

mixed|string

Overrides StrategyInterface::extract

File

vendor/zendframework/zend-hydrator/src/Strategy/DateTimeFormatterStrategy.php, line 48

Class

DateTimeFormatterStrategy

Namespace

Zend\Hydrator\Strategy

Code

public function extract($value) {
  if ($value instanceof DateTime) {
    return $value
      ->format($this->format);
  }
  return $value;
}