bastiam / php-excel-reader2

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

Time values under 1 hour have 12 hrs added #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Parse any spreadsheet with time values h:mm:ss (no date) like 0:54:13
2.Get the cell contents with val()

What is the expected output? What do you see instead?
Expected output is a string '0:54:13'. Instead the output is '12:54:13'. i.e., 
12 hours has been added on. 
This doesn't happen with time values 1:00:00 and larger.

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

Please provide any additional information below.
Internally the code has chosen the date() format string 'g:i:s' when parsing a 
time like '0:54:13'.
The mktime() arguments are hours=0 mins=54 secs=13 mon=12 mday=30 year=1899

A bodged workaround is to force the $format to be 'H:i:s' like so:

if ($format == "g:i:s" && !$hours) $format = 'H:i:s';

Original issue reported on code.google.com by nickcons...@googlemail.com on 3 May 2013 at 10:03