bastiam / php-excel-reader2

Automatically exported from code.google.com/p/php-excel-reader2
0 stars 0 forks source link

Times values over 24 hrs are formatted as a fraction of 1 day #19

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Excel spreadsheet with hh:mm:ss time values over 24 hrs. e.g., "25:16:09"
2. Load with php-excel-reader2
3. Display with $data->val()

What is the expected output? What do you see instead?
Expect to preserve the time value, "25:16:09".
Instead only the fraction of a day is seen, "01:16:09".

What version of the product are you using? On what operating system?
v2.22 on CentOS 6

Please provide any additional information below.
Little hack to work around this problem, until a proper fix is made by someone:

      $days = floor ( $numValue );
      if ($format == "H:i:s" && $days):
        $hours += $days*24;
        $string = sprintf("%02d:%02d:%02d", $hours, $mins, $secs);
      else:
        $string = date ( $format, mktime ( $hours, $mins, $secs, $dateinfo ["mon"], $dateinfo ["mday"], $dateinfo ["year"] ) );
      endif;

Original issue reported on code.google.com by nickcons...@googlemail.com on 17 Apr 2013 at 12:12