Problems with Dates

  • tonyh2o

    tonyh2o - 2004-10-06

    I have a file with a column containing dates in the format m/d/Y (eg. 4/30/2004) when processing it with this script and displaying it, it outputs 29/4/2004 for that same date.  Can anybody please help me on this one?  I checked all the other posts and none of them refers to this specific problem.

    Thank you for this awesome script.  It works beautifully except for this small bug.  Thank you in advance for your help.


    • aszalacinski

      aszalacinski - 2004-10-07

      I too am having the problem of the Reader rolling back my dates one day... even ones that start at the beginning of the month are being rolled back to the last day of the previous month... I have submitted a bug...

    • John Harris U. Pe

      I had some similar problems before with the dates / time being rolled back.  I hard-coded something on the file "excel_reader.php" (now 'reader.php'?).  On the function createDate, I added the line '$numValue += 0.000000000001;' after the line '$raw = $numValue;'

      It fixed my problems before. I don't know if the latest version (2I) had already fixed this problem, though. Hope that helps!

    • ospinto

      ospinto - 2004-10-25

      in the reader.php, look for the createDate function.
      right after the line
      "$utcValue = round($utcDays * Spreadsheet_Excel_Reader_msInADay);"
      this adds an extra day to the date.

      to change your date formats to be m/d/Y, etc...
      change the values in the $dateFormats array (in the reader.php, a few lines from the beginning of the doc), change it to m/d/Y, M-d-Y, etc... instead of d/m/Y, d-M-Y, etc...

      That should do it.

    • Sesha Srinivas

      Sesha Srinivas - 2005-10-18

      hi there,
      I have an excel sheet which has the date format like "n/j/Y G:i:s A"
      I tried all kinds of tricks but always got the returned dates one day more when i used
      $utcValue+=86400;if time in the date column is not 12:00:00 am.
      this is what i did.
      $utcValue+=(86400 - 72000);
      after the line
      "$utcValue = round($utcDays * Spreadsheet_Excel_Reader_msInADay);"
      i am using 72000 because i was getting a difference of 4 hrs.
      When i do this any the date column is giving me the correct values for any type of date and time combination.

      I hope this could be of help.

      • Brenton B

        Brenton B - 2006-03-08


        I think this is due to a timezone discrepency.

    • Alister

      Alister - 2009-01-31

      need patch for reader.php

      i change this lines

                  $utcValue = round(($utcDays+1) * SPREADSHEET_EXCEL_READER_MSINADAY);
                  $utcValue = round(($utcDays) * SPREADSHEET_EXCEL_READER_MSINADAY);


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks