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

DJL’s picture

Me 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?

cangeceiro’s picture

im still having this issue....has no one ran across this and fixed it?

benansell’s picture

Had the same issue. Could not import any fields with unix time stamp or ISO 8601 formats.

Garrett Albright’s picture

I 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.

      $node_sub = node_submit($node);
      $node_sub->field_times = $node->field_times;
      node_save($node_sub);

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.

Frank Ralf’s picture

Hello,

This worked for me when importing nodes as event type (Drupal 5.2):

Start	End	Text
2008-12-24 18:30	2008-12-24 23:59	Christmas Eve
2008-12-31 23:59	2009-01-01 00:00	New Year's Eve

(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

seaneffel’s picture

Frank, 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.

DJL’s picture

DJL, check your timezone settings on your date field. I kept getting incorrect time imports, always the same number of hours off.

The 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.

mvc’s picture

I'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.

Robrecht Jacques’s picture

Status: Active » Closed (won't fix)

5.x is no longer supported. If you have the same issue with the 6.x branch please reopen.