configuration['from_format'])) { throw new MigrateException('Format date plugin is missing from_format configuration.'); } if (empty($this->configuration['to_format'])) { throw new MigrateException('Format date plugin is missing to_format configuration.'); } $fromFormat = $this->configuration['from_format']; $toFormat = $this->configuration['to_format']; $timezone = isset($this->configuration['timezone']) ? $this->configuration['timezone'] : NULL; $settings = isset($this->configuration['settings']) ? $this->configuration['settings'] : []; // Attempts to transform the supplied date using the defined input format. // DateTimePlus::createFromFormat can throw exceptions, so we need to // explicitly check for problems. try { $transformed = DateTimePlus::createFromFormat($fromFormat, $value, $timezone, $settings)->format($toFormat); } catch (\InvalidArgumentException $e) { throw new MigrateException(sprintf('Format date plugin could not transform "%s" using the format "%s". Error: %s', $value, $fromFormat, $e->getMessage()), $e->getCode(), $e); } catch (\UnexpectedValueException $e) { throw new MigrateException(sprintf('Format date plugin could not transform "%s" using the format "%s". Error: %s', $value, $fromFormat, $e->getMessage()), $e->getCode(), $e); } return $transformed; } }