Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to import datestamp fields to a content type with no success. I have attempted to import the field as a unix timestamp, epoch, and the mm/dd/yyyy formats with no success. any idea what i could be doing wrong?
Comments
Comment #1
DJL CreditAttribution: DJL commentedMe Too.
I am trying to import data into CCK fields and event time start field.
I my my csv date field onto "Event: complete startdate or time stamp"
I cam import correctly into CCK text fields,
but the date / time follows no logic.
The format for the date/time I am using is YYYYMMDD HH:MM
I have tried YYYY-MM-DD HH:MM
YYYY-MM-DDTHH:MM
YYYY-MM-DD - HH:MM
DD/MM/YYYY - HH:MM
with no result. Please advise
These dates
"20/04/2008 - 09:30"
"27/04/2008 - 09:30"
"11/05/2008 - 11:30"
were imported as
Start: 04/08/2009 - 09:00
Start: 04/03/2010 - 09:00
Start: 05/11/2008 - 11:30
the third one is correct!!!!
WHY?
Comment #2
cangeceiro CreditAttribution: cangeceiro commentedim still having this issue....has no one ran across this and fixed it?
Comment #3
benansell CreditAttribution: benansell commentedHad the same issue. Could not import any fields with unix time stamp or ISO 8601 formats.
Comment #4
Garrett Albright CreditAttribution: Garrett Albright commentedI ran into this too. The problem seems to occur at line 685 of node_import.module:
$node = node_submit($node);
if you do a var_dump($node);die() before this line, the date values are fine, but if you do a var_dump($node);die(); after it, the values are set to NULL. I don't think this is Node Import's fault, since node_submit() is a core API call. However, it calls functions in other modules, so I'm guessing one of those functions is mangling things. If I had a PHP debugger and/or more time, I'd figure out what and where, but I've already spent nearly three hours trying to figure it out, so it's hack time.
I hacked node_import.module to put the result of node_submit() into another variable (instead of overwriting $node), then copied over the values of the errant field (field_times in this case) from $node into it.
This works, but if there's multiple date values in the field, only one gets inserted into the database. That is probably an unrelated problem, though, and for our client's needs, it'll be good enough for now.
Comment #5
Frank Ralf CreditAttribution: Frank Ralf commentedHello,
This worked for me when importing nodes as event type (Drupal 5.2):
(Still haven't figured out, why this doesn't work with Drupal 6.2, though. Suppose some function in supported/event.inc has to be changed.)
Regards,
Frank
Comment #6
seaneffel CreditAttribution: seaneffel commentedFrank, your date/time formatting worked for me. Thanks for showing your work.
DJL, check your timezone settings on your date field. I kept getting incorrect time imports, always the same number of hours off.
Comment #7
DJL CreditAttribution: DJL commentedThe errors in my case were random.
I have now abandoned this approach in favour of the new services module, which I can automate entirely in Basic from my database program.
Comment #8
mvcI've submitted a patch to date.module which solves this problem for me. http://drupal.org/node/282228
If you've encountered this problem, please test and review that patch.
One work around would be to use text field dates instead of select list dates in your content type.
Comment #9
Robrecht Jacques CreditAttribution: Robrecht Jacques commented5.x is no longer supported. If you have the same issue with the 6.x branch please reopen.