I am trying to prepare an Excel report using php. In the report I have a column called date. I am trying to format the date as date('d-M-Y',strtotime($row['MYDATE']));.
So my problem is when displayed on the browser it is displaying in correct format (10-SEP-2010) but when on the excel sheet it is displaying as follows (9/10/2010).
Why would there be difference and how do I resolve this?
Possibly because in the PHP code you are explicitly specifying the format to use, so it appears in the browser as expected (a date value has been converted into a “string”).
In Excel, the date string is being auto-detected and being formatted according to the systme’s Regional settings (which seems to be set to US on the target system).