seenu_vas80 Posted November 14, 2008 Share Posted November 14, 2008 Hi, Iam using PHP Excel Reader class to read the datas from the excel and inserting the values into Database accordingly. The problem i face is when the date column field is read from the excel the value is not the same when inserted in the database in the server. Date decrements by one since in the reader.php in the class, the date column value has been converted to corresponding UNIX time stamp. Returned value differs from the original value in the excel. For e.g. the date column value in the excel is 6/17/2008 and it has been converted to UNIX timestamp and value inserted in the database is 06/16/2008. Is there any solution for the above issue. Kindly reply back if there is any other information that is needed for the above issue. How to read the date column from the excel as it is? Any comments will be great help... NOTE:Server PHP version is 5.2.6 and mysql version is 5.0.51 Thanks in advance, Srinivasan Quote Link to comment https://forums.phpfreaks.com/topic/132683-reg-php-excel-reader-date-colum/ Share on other sites More sharing options...
Mark Baker Posted November 14, 2008 Share Posted November 14, 2008 Well the simple solution would be to add 1 day to the value before inserting it. Excel holds the data as a floating point value representing the number of days since 1st January 1900 or 1st January 1904. However, when the base date is 1st January 1900, it also believes that there was a 29the February of that year. Without checking the code, I couldn't tell you why you're getting this discrepancy; but it may be related to the spurious 1900 leap day. Quote Link to comment https://forums.phpfreaks.com/topic/132683-reg-php-excel-reader-date-colum/#findComment-690135 Share on other sites More sharing options...
seenu_vas80 Posted December 1, 2008 Author Share Posted December 1, 2008 Hi, I have tried that also by adding 1 day to the date read from the excel. whether this will be the right solution in all the cases. Since date column will be converted to unix timestamp from the date 1970.. In that case , server date will differ accordingly and the date will vary.... Please help on this... Regards Srini Quote Link to comment https://forums.phpfreaks.com/topic/132683-reg-php-excel-reader-date-colum/#findComment-703081 Share on other sites More sharing options...
Mark Baker Posted December 1, 2008 Share Posted December 1, 2008 Since date column will be converted to unix timestamp from the date 1970.. In that case , server date will differ accordingly and the date will vary.... Please help on this... I can tell you how to convert an Excel timestamp to a php timestamp, and vice versa. However, what I don't know is exactly what you're getting from your PHP Excel Reader class. Give me an example of the data value that you're getting, and what you think it should be. Quote Link to comment https://forums.phpfreaks.com/topic/132683-reg-php-excel-reader-date-colum/#findComment-703095 Share on other sites More sharing options...
popuskin Posted December 5, 2008 Share Posted December 5, 2008 Hello seenu_vas80, I have a problem of inserting excel into mysql. Can you please let me have the code to insert excel into mysql? I would be very greatful for this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/132683-reg-php-excel-reader-date-colum/#findComment-706798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.