0

I have a csv with a Date field that contains the date in one of the following formats:

  • dd/mm/yy (ex. 13/11/04)
  • dd/mm/yyyy (ex. 13/11/2004)

I need to import these dates to my field in the format dd-mm-yyyy, using feeds.

I've tried everything but without success. I have my date field set with my custom date format (dd-mm-yyyy).

What do I need to do in feeds (or even feeds tamper) to import this data?

Thanks.

1

I've struggled with this question today, and because i didn't found any clear answer here's the method with drupal 8.7:

  • go to your node type structure, and select the display of your field (for example : DD-MM-YYYY)
  • go back to the feeds mapping, remove your date entry.
  • add a new entry for the date, or rebuild the entire mapping if you can't change the order of your csv.
  • clear the cache
  • the date work now with your new format
| improve this answer | |
0

The date itself typically is stored in the mysql database as a timestamp or datetime format, depending on the configuration when you setup the field.

To ensure the Feeds' built-in date mapper importer processes the dates properly, I recommend:

  1. open the CSV as a spreadsheet
  2. reformat the date column to be an integer timestamp field
  3. Resaved the csv with the numeric value for the date rather than the formatted value.
  4. Update your feed importer mapping for the revised date field/column data from the CSV.
  5. Run the import.

Alternatively, the Feeds Tamper module may be used to parse the date parts from a string formatted date in your Csv, and then join them as needed into a properly formatted date entry; but it would still require a consistent format in the csv. (you need either two or four-digit years in all the dates)

| improve this answer | |
  • I don't have write access to the csv (I'm importing externally). Anyway, I solved my problem with Feeds Tamper and the PHP plugin. I know it's not the cleaner solution but it was the only one that solved my problem. – zephirus Aug 29 '18 at 14:18
0

Goussing is right, this ansewr is based on his (i upvoted his answer), i did this on D7, steps:

1.- convert your date to unix (https://www.extendoffice.com/documents/excel/2473-excel-timestamp-to-date.html), (i did this in libreoffice, same thing) this way no matter wich language is your drupal site and date formatting.

2.- go to your node display settings, select your date field (my case a field collection field), select custom and in format enter U (for unix).

3.- important! as Goussin sugests, delete this field mapping and re-enter it again, dont mind of CVS order in columns.

4.- clerar caches

5.- do your import by feeds.

6.- change your field display as desired. done.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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