1

I'm importing a date field in the format:

dd/mm/yyyy

I want to set this as the created date for the node I'm creating/updating.

I've tried the Feeds tamper module but the date function seem to convert between a string and a Unix timestamp, which doesn't seem to work anyway.

What's the best way to do this?

1 Answer 1

1

You can try to use the hook_feeds_presave in a custom module :

function mymodule_feeds_presave(FeedsSource $source, $entity, $item, $entity_id) {
  $your_import_date = explode('/', $item['your_import_date']);
  $your_import_date_formated = $your_import_date[2] . '-' . $your_import_date[1] . '-' . $your_import_date[0] . ' 00:00:00';
  $item['your_import_date'] = strtotime($your_import_date_formated);
  $entity->created = $item['your_import_date'];
}
1
  • Thanks very much pbonnefoi. Just tried this and it worked perfectly. Commented Jun 24, 2014 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.