iftikhar786 / php-excel-reader

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

Date output not standard #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The standard date output is not in a standard format which can be read (for 
example) by the strtotime()-function.

The current output is days/months/years. This notation usually calls either 
for dots:
  days.months.years

Or for another order:
  months/days/years

I don't know if this is an Excel problem or a problem with the script 
interpreting the right date format.

Workaround:
 Change the date formats around lines 410-420 to your liking.

Original issue reported on code.google.com by 128625 on 17 Dec 2008 at 12:14

GoogleCodeExporter commented 8 years ago
I'm having issues with reading dates in the format d/m/y. For e.g., in Excel 
03/06/1973 has a date format of DD/MM/YYYY. php-excel-reader outputs
SunSun/JunJun/1973197319731973.

Help will be appreciated.

Thanks

Original comment by roa...@gmail.com on 26 Jan 2009 at 7:24

GoogleCodeExporter commented 8 years ago
I'm not sure how the code behaves when using non-US format dates. For example, 
when
DD/MM/YYYY is the default.

I just put a date in and set the format to DD/MM/YYYY and it showed up 
correctly in
my PHP output.

To the original reporter - could you give more details? I don't really 
understand
what your bug report means.

Original comment by matthew....@gmail.com on 26 Jan 2009 at 3:43

GoogleCodeExporter commented 8 years ago
@Matthew: If I'm reading a cell from the sheet with val() and this cell is in 
the 
format 'date', then I'll get a string back in the form of days/months/years. 
That's a 
weird format for a date.

And yes, I'm using a 'european' spreadsheet, perhaps that's the problem.

How do you 'set the format'? Is there a function within the reader?

Original comment by 128625 on 26 Jan 2009 at 3:50

GoogleCodeExporter commented 8 years ago
d/m/y is the default "european" format for dates. I believe that if a cell is 
set to
date, and Excel is in "european" mode, it will report the format as DD/MM/YYYY, 
which
the php reader then uses. I don't think there is a way around this other than
manually setting the cell's date format to what you prefer.

Original comment by matthew....@gmail.com on 26 Jan 2009 at 4:08

GoogleCodeExporter commented 8 years ago
Same problem for me as well - I'm using the European format for Excel, but I'm 
manipulating dates in the US format - mm/dd/yyyy hh:mm:ss AM/PM.

@Mathew, I think you mean that Excel Reader will take whatever date is 
displayed in 
the cell in Excel, the dates I'm using are in the US format, but they are 
converted 
to the European format when Excel Reader reports it.

I could upload a sample file if the above is not clear.
I very much appreciate the amount of time you've put into this - thanks a lot!

Original comment by karthikp...@gmail.com on 26 Jan 2009 at 6:03

GoogleCodeExporter commented 8 years ago
Can you upload an example xls?

If your worksheet is in european format, and a cell is showing 1/2/09, then 
that will
be assumed (by excel) to mean Feb 1, 2009. So that is what PHP will report also.

Also, if you enter, for example, 01/31/2009, it will not accept it as a date. 
You
need to enter 31/01/2009. If you are in european format and your cell is showing
01/31/2009, then you either have the format explicitly or the cell is stored as 
text
rather than a date.

Original comment by matthew....@gmail.com on 26 Jan 2009 at 6:20

GoogleCodeExporter commented 8 years ago
The problem that I reported earlier is an Openoffice issue; if you have 
openoffice,
you can repeat this anomaly by changing the date format and saving in Excel. 

Another issue I just discovered (I guess most of us know this) is that the 
default
date formats in Excel switches date orders with OS.  In my case (using a 
Linux-based
server) $obj->format($row,$col) comes in very handy.

Original comment by roa...@gmail.com on 26 Jan 2009 at 7:44

GoogleCodeExporter commented 8 years ago
hmm I have different problem, it 's always increasing the date value with 1. so 
if I
have 12/31/2008, the output will be displayed 01/01/2009

please help for this problem

thnaks 

Original comment by maoneid on 18 Feb 2009 at 4:37

GoogleCodeExporter commented 8 years ago
Hi!
I have the same problem as @maoneid.

Please help me too!!

Original comment by barsyk...@gmail.com on 18 Mar 2009 at 2:10

GoogleCodeExporter commented 8 years ago
Hello , same problem as @maoneid and barsykoff. Help us please!

Original comment by hypno...@gmail.com on 27 Mar 2009 at 11:01

GoogleCodeExporter commented 8 years ago
This will be fixed in release 2.2

Original comment by matthew....@gmail.com on 27 Mar 2009 at 11:42

GoogleCodeExporter commented 8 years ago

Original comment by matthew....@gmail.com on 27 Mar 2009 at 11:43

GoogleCodeExporter commented 8 years ago
files that i save with Open Office 2.2.1 (English) on my English Vista 32bit 
have the
same issues with the dates. Files are saved in what OO calls "MS Excel 
97/2000/XP
(.xls)" format. This might also be a OO bug too.

the example package with the modified xls can be found at
http://test.wendell.fi/php_excel_reader/example.php
only C1 and G1 where edited in example.xls

Original comment by willewen...@gmail.com on 22 Apr 2009 at 1:39

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, I had the same issue and I solved it with some changes in the code, see the 
patch attached.

Probably it isn't the most elegant way to solve it but considering my lack of 
time and knowledge of this project it was the easiest and fastest solution.

I hope it helps people in the same situation.

Original comment by jpguer...@gmail.com on 4 Nov 2010 at 11:16

Attachments:

GoogleCodeExporter commented 8 years ago
yuiyu

Original comment by ashok....@gmail.com on 20 Jan 2011 at 11:31

GoogleCodeExporter commented 8 years ago
This patch should be extended with 'YY' -> 'y'

Original comment by buzan...@gmail.com on 18 Mar 2011 at 4:44