Date format issue
Posted by: venkatesraj (115.241.35.---)
Date: March 20, 2014 05:55PM

Hi,
We have developed application in PHP. We are reading data from Excel sheet and displaying the manupulated data's in web page based on business requirement. Every things are working fine in our local environemnt. When we are moved to production data and month showing 1 value previous. For exemple, Decemeber 2013 data's showing like November 2013. Same Date also same issue.

Only difference between local and server is WAMP Server versions. In local environment we are using WAMP Server 2.4 and server we are using WAMP Server 2.0.


Did any one face this issue?

Thanks in Advance,
Raj

Options: ReplyQuote
Re: Date format issue
Posted by: RiggsFolly (---.as13285.net)
Date: March 20, 2014 06:32PM

Are you sure this is not just a timezone issue?

Can you answer these questions once for your dev environment and once for your live environment please so we can better diagnose the problem [forum.wampserver.com]

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Date format issue
Posted by: venkatesraj (203.99.205.---)
Date: March 21, 2014 06:43AM

Hi,
We don't know whethere its time zone issue or some thing else.

When we are printing the data in the production server, the 1st month value in the excel is January 2012 and it is showing December 2011.

For some other reports the 1st data in the excel is 1st January 2012 and it is priting 31st December 2011.

This means the data in the array is stored with 1 day/1 month offset.


Thanks,
Raj

Options: ReplyQuote
Re: Date format issue
Posted by: venkatesraj (203.99.205.---)
Date: March 21, 2014 07:49AM

Hi,

Seems issue not with Wamp Server version. In one of the local environment, we have WAMP Server 2.0 and that's working fine. The issue is with some thing in Production server.

Has any one faced this issue before.


Thanks,
Raj

Options: ReplyQuote
Re: Date format issue
Posted by: RiggsFolly (---.as13285.net)
Date: March 21, 2014 09:55AM

Can you show some examples of the code being used on this date calculation and the data it is processing please.

Also whch version of Apache and PHP is actually being used on each server.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Date format issue
Posted by: venkatesraj (203.99.206.---)
Date: March 21, 2014 10:51AM

Hi,

In our local environment we are using Apache version 2.4.4 and PHP version 5.4.12.

We are reading data from excel sheet and using json to send data.

For server software details will check and update.


Example :
$excel = new Spreadsheet_Excel_Reader();
$excel->read('../xyz/'.$q.'.xls');


Thanks,
Raj

Options: ReplyQuote
Re: Date format issue
Posted by: RiggsFolly (---.as13285.net)
Date: March 21, 2014 12:17PM

Yes ok,

But what PHP code do you use on the value that you extract from the cell containing the date??

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Date format issue
Posted by: venkatesraj (203.99.205.---)
Date: March 24, 2014 06:47AM

Please find the below sample code.

function createDate($numValue)
{
if ($numValue > 1) {
$utcDays = $numValue - ($this->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS);
$utcValue = round(($utcDays) * SPREADSHEET_EXCEL_READER_MSINADAY);
$string = date ($this->curformat, $utcValue);
$raw = $utcValue;
} else {
$raw = $numValue;
$hours = floor($numValue * 24);
$mins = floor($numValue * 24 * 60) - $hours * 60;
$secs = floor($numValue * SPREADSHEET_EXCEL_READER_MSINADAY) - $hours * 60 * 60 - $mins * 60;
$string = date ($this->curformat, mktime($hours, $mins, $secs));
}

return array($string, $raw);
}



Edited 2 time(s). Last edit at 03/24/2014 01:29PM by venkatesraj.

Options: ReplyQuote
Re: Date format issue
Posted by: RiggsFolly (---.as13285.net)
Date: March 24, 2014 11:54AM

I have no intention of wading through 944 lines of code looking for the ONE LINE that is processing a date.

I expected you to supply a FEW LINES OF CODE and the data being processed

Something like this :-

    var_dump( $ss_date )
    
    //the code that is acting upon that one piece of data that generates the wrong date eg
    $x = date('Y-m-d', $ss_date );

    var_dump( $x );


Please edit your previous post and remove all that code.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 03/24/2014 11:55AM by RiggsFolly.

Options: ReplyQuote


Sorry, only registered users may post in this forum.