You are here

public function FeedsEntityProcessorPropertyDate::setValue in Feeds entity processor 7

Implements FeedsEntityProcessorPropertyInterface::setValue().

Overrides FeedsEntityProcessorPropertyDefault::setValue

File

src/Property/FeedsEntityProcessorPropertyDate.php, line 141
Contains FeedsEntityProcessorPropertyDate.

Class

FeedsEntityProcessorPropertyDate
Handler for date property.

Code

public function setValue($value, array $mapping) {

  // Convert the date value.
  if (module_exists('date_api') && !is_numeric($value)) {
    $default_tz = new DateTimeZone($this
      ->getDefaultTimezone($mapping));
    $date = $this
      ->convertDate($value, $default_tz);
    $value = $date
      ->format('U');
  }
  parent::setValue($value, $mapping);
}