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 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
Comment #1
pachyderm CreditAttribution: pachyderm commentedLook 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.
Comment #2
theroyal CreditAttribution: theroyal commentedElephant_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
Comment #3
theroyal CreditAttribution: theroyal commentedok 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.
Comment #4
presleyd CreditAttribution: presleyd commentedI 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.
Comment #5
theroyal CreditAttribution: theroyal commentedsubscribing
Comment #6
mrfree CreditAttribution: mrfree commentedsubscribe
Comment #7
kalis1In 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").
Comment #8
twistor CreditAttribution: twistor as a volunteer commented