I am importing CSV files daily,
and it contains a YYYYMMDD date format records, (which i am ignoring now because I failed in importing this field, maybe coz its format which is different than drupal style)
NOTE: it is date not time.

Please any easy solution for that ? and am not a developer. but i know little php and not bad in drupal.

Thanking you guys.

Comments

pachyderm’s picture

Look in FeedParser.inc
The code checks for if the time value is 'numeric' and the code then later assigns ANY numeric $time value to be a UNIX TIMESTAMP, which is a BAD assumption.

I modified the code on line 491 like this:
if (is_numeric($time)) {
CHANGED TO:
if (is_numeric($time) && (strlen($time) == 10) ) {

I made sure that it only made it into a unix timestamp if there was 10 numeric digits. (on my system I could depend on them being in that precision)

Your date stamp is 8 digits long.(as was mine). This fix will work for you but potentially break your import of 64bit unix timestamps.

The developer said my fix is not valid, and it isn't for all cases but for ours it is.

theroyal’s picture

Issue tags: +date format, +YYYYMMDD

Elephant_drupal

Thanks a lot my friend :) if this is working then you made my day,

but b4 I change the code I want to make sure

do I have to change it to 10 :
if (is_numeric($time) && (strlen($time) == 10) ) {

or to 8 ? since my case is 8 digits not 10

if (is_numeric($time) && (strlen($time) == 8) ) {

thanking you

theroyal’s picture

ok I got it,
it is working right now thanks a lot my friend, you really gave me a great help.
wish you all the best.

presleyd’s picture

I agree that this is not the ideal way to do this but neither is the numeric check to determine what format the number is in.

Only way around this I can think of would be to add a check box to the mapper settings form that allows you to specify if dates are UNIX timestamps. I'll look at the form. In my mind it would work like the checkbox that appears to select whether the field is a unique target for any date cck types selected.

theroyal’s picture

subscribing

mrfree’s picture

subscribe

kalis1’s picture

In http://drupal.org/node/1097104, you can find a feeds_tamper plugin which can convert a string to a UNIX timestamp... I had the same issue and with this plugin my dates are now correctly imported (eg. from "20110109" to "2011-01-09T00:00:00").

twistor’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
Issue tags: -date format, -YYYYMMDD