Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 301029

FormatDate process plugin

$
0
0

In my Migration from Joomla to Drupal the format_date plugin failed.

  created:
    -
      plugin: format_date
      from_format: 'Y-m-d TH:i:s'
      to_format: 'Y-m-d\TH:i:s'
      source: created

With the error "Format date plugin could not transform '2012-02-26 11:25:38' using the format 'Y-m-d TH:i:s' for destination 'created'. Error: The date cannot be created from a format."

  created:
    -
      plugin: format_date
      from_format: 'Y-m-d TH:i:s'
      to_format: 'Y-m-d\TH:i:s'
    -
      plugin: date_format_alter
      source: created

If I add strtotime to in a date_format_alter process plugin it works.

class DateFormatAlter extends ProcessPluginBase {
    public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
      $unixTimestamp = strtotime($value);
      return $unixTimestamp;
    }
}

Viewing all articles
Browse latest Browse all 301029

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>