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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.