Dates incorrectly displayed

This public forum is for user-to-user discussions of PHP Report Maker. Note that this is not support forum.

Dates incorrectly displayed

Postby leontet » Wed Sep 06, 2017 5:48 am

Hello again, everyone!

I've just been warned that dates displayed in reports are incorrect.
I checked and indeed, ALL the dates are incorrect, being 1 day less than the database value.
I mean, if a date is supposed to be May 31, 2017 (and it is so in the database), it is displayed as May 30, 2017.
I sought for a record including a date marking the first day of a month to no avail, so I don't know how would the date be displayed in such a case.

I'm using the latest version of PHP Report Maker and my project links to an Access2016 database file (*.accdb).
The report returning the aforementioned error is generated by a phpReportMaker "view". I don't have any reports based on Access queries to include dates, so I don't know if they behave the same.

In my particular case this error is nothing more than annoying, but I'm pretty sure there might be other cases in which the problem would become important.

Any explanation or solution to help correct this???
Thank you in advance!
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: Dates incorrectly displayed

Postby arbei » Wed Sep 06, 2017 10:48 am

Double check your settings with correct timezone in [Locale Settings] of your corresponding locale.
arbei
 
Posts: 1499
Joined: Wed Sep 09, 2015 10:13 am

Re: Dates incorrectly displayed

Postby leontet » Wed Sep 06, 2017 7:17 pm

I checked TimeZone setting in both PHP Report Maker "Locale Settings" and in my Windows server php installation: they are identical.
I further checked the time zone in my Windows desktop PC (that runs MS Access) and my Windows Server (that runs the offending code): they are identical again, and similar to the previous ones.

I understand why you thought of a TimeZone setting mismatch, but I frankly don't know where else to seek for such a mismatch...
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: Dates incorrectly displayed

Postby leontet » Thu Sep 07, 2017 10:16 am

I digged a little bit deeper into the timezone matter.
It is true a timezone mismatch is the reason of the incorrect display of the dates.
But it's also true it's a bug in the program that leads to this situation.
I created a new custom page including some date functions (display the date and time of last modification of a file, display today date and time).
With the correct timezone set, these dates are correctly displayed.
Nevertheless, the dates read from the Access database file and displayed in tables in the generated reports DO NOT display correctly in any circumstances.
In the latter case, the timezone is always set to GMT, no matter what the "Locale Settings" contains and no matter the setting in php.ini
It is thus pretty obvious the program code has a flow somewhere...
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: Dates incorrectly displayed

Postby Webmaster » Thu Sep 07, 2017 1:37 pm

Assuming you use the default language file (english.xml), you can change the timezone setting same as your php.ini by:
- Tools -> Local Settings, select the "en.json" file
- Change the [Time zone] setting same to php.ini

Regenerate all files and try again.

If you are using Windows, also make sure that your Windows locale match with the time zone settings in php.ini.
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm

Re: Dates incorrectly displayed

Postby leontet » Thu Sep 07, 2017 3:53 pm

Hi,
I already did what you instructed me, to no avail.
No matter what timezone I'm picking in the "Locale settings", there is always a difference of -3 hours between the dates in the Access database and those displayed in my report table.
As the dates in the database have a time of 0:00, the day displayed in the report is decreased by 1.
That means a database date of May 31 2017 0:00 is displayed in the report as May 30 2017 21:00
I underline the fact this difference remains the same no matter what timezone the "Locale Settings" or the php.ini indicate.
These 3 hours are exactly the difference between my timezone and GMT.
Running the Access queries on which the report is built I get the correct dates.
As I previously mentioned, in a custom test php page generated by phpRM in the same project and including (by inserting the code in the Contents frame) some date() functions, the dates are correctly displayed and are sensitive to the test changes of timezone I made in the "Locale Settings". By contrast, the dates read from the Access database file and displayed in my report are NOT sensitive to any such changes. None of these dates (those in the test file and those in the report table) do not react to changes of timezone in php.ini.
It means that when building the report, phpRM writes an empty string instead of the correct name of the timezone.
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: Dates incorrectly displayed

Postby Webmaster » Fri Sep 08, 2017 9:26 am

As explained:
> If you are using Windows, also make sure that your Windows locale match with the time zone settings in php.ini.
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm

Re: Dates incorrectly displayed

Postby leontet » Fri Sep 08, 2017 9:39 pm

My Windows locale settings are identical, both on the desktop PC running the Access database and the server running the scripts.
And yes, they are similar to the ones in php.ini and "Locale Settings" of phpRM.

I read on Microsoft support site Access doesn't support timezones.
I also checked and the chosen timezone is correctly applied to the report page by phpRM.
Still, the displayed dates are different from the ones in the database and DO NOT react to any changes of the timezone in "Locale Settings".

For the time being, I modified the Access query on which the reports are generated by adding a calculated field that adds 3 hours to the dates.
My report displays this calculated field now instead of the one with the original date and everything looks fine.
But I still don't understand why the locale settings are not applied to the 'date' type data in that report page...

Anyway, thank you!
leontet
 
Posts: 13
Joined: Tue Jul 18, 2017 5:38 am

Re: Dates incorrectly displayed

Postby Webmaster » Sat Sep 09, 2017 9:23 am

> My Windows locale settings are identical

If yes, it should work. What is your Windows regional settings and timezone settings in php.ini?
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm


Return to General Discussion (PHP Report Maker)