I'm trying to import a date into a node field. The node field is formatted as a date field and has "customize input format" set to Y-m-d. Similarly, my csv file I'm importing has dates set in the format of 2012-04-18.
However, after I import and look at the data, for some reason it shows up as 2012-04-17...This is absolutely mind boggling to me. I checked about 5 of the created nodes from my csv file that contains 2403 records, and all of them had the imported date with the day one less than what was imported. Even a date imported as 2011-12-01 showed up as 2011-11-30!
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | date_field_settings.jpg | 22.41 KB | RyFo18 |
| #5 | date_field_settings2.jpg | 24.42 KB | RyFo18 |
| #5 | feeds_tamper_settings.jpg | 25.38 KB | RyFo18 |
| #5 | feeds_import_results.jpg | 19.94 KB | RyFo18 |
Comments
Comment #1
hanno commentedProbably a timezone setting issue for your date field as the time of a date without time is handled as 00:00 -timezone. Did you experience with the timezone settings?
Comment #2
hanno commentedComment #3
franzIf you have trouble with timezone, you might want to use Feeds Tamper plugin "String to Unix timestamp".
Comment #4
franzComment #5
RyFo18 commentedFor my date field, I have the granularity selected as Year, Month, Day. I have tried to have Time Zone Handling set to "Site's Time Zone", however, when I do this the following error occurs:
Dates without hours granularity must not use any timezone handling.
I went a step further and recreated the field with a granularity of Year, Month, Day, Hours, Minutes, Seconds so I could set the handling to "Site's Time Zone". Unfortunately, it still imports as a day earlier!
I've uploaded 4 screenshots showing my settings. Two of them show the field settings for my Date field. The third picture shows the feeds importer setting, and the fourth is a screenshot of my node being displayed after the import. Note that I also import this same date field to the title using a feeds tamper, so you can in fact see that the imported date is 2003-09-07, while the displayed date is September 6, 2003.
I am also convinced that this probably has to do with Timezone handling, but I'm not sure what else to try.
Comment #6
RyFo18 commentedUPDATE
So it looks like I got it to work (kind of). I also realized that in another field that imports time, I was getting the incorrect time.
I tried to import as "Site's Time Zone" and this was not working. When I switched to UTC, that worked, though I'm not sure why. Any insight?
So for my date field, I added "Hours" to the granularity so that I could select UTC (since you can't do timezone handling without hours as the granularity). The date shows up correctly...I have the date set to display like this though:
September 7, 2003
When I add the hours granularity it shows up as:
September 7, 2003 (All-Day)
I can't really figure out how to get rid of this (All-Day) thing. Probably not a Feeds issue, but worth asking here.
Comment #7
hanno commentedYou can try the patch mentioned in #722740: Feeds Date mapper converts imported dates to GMT unless in UNIX timestamp format.
Comment #8
RyFo18 commentedThanks for the suggestions. In the end, I used Feeds Tamper to "rewrite string to UNIX timestamp" and that seemed to get all of my dates in correctly.
Comment #9
RyFo18 commented