Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.9.4
-
Fix Version/s: None
-
Component/s: Course
-
Labels:None
-
Database:MySQL
-
Difficulty:Easy
-
Affected Branches:MOODLE_19_STABLE
Description
When using the Course Reports functionality, exporting in Excel does not account for the timezone of the user. Exporting to a text file and showing the data on the screen shows the correct time. We have only verified that this is an issue in 1.9.4, and have not tested other versions.
Instructions to replicate:
1. Login as a Site Administrator
2. From the Site Administrator Nav Menu, click on Reports -> Logs
3. Run any report that contains data, make sure the "Display on Page" option is selected
4. Run the same report with the "Download in Excel format" option selected.
5. Compare the values of the Time column. The values of the Excel format are set to GMT time, while the values of the On Page report are correctly adjusted to the user's time zone.
6. (Optional) Run the same report with "Download in text format". These values are correct and consistent with the On Page report format.
This hopefully is a pretty quick fix. Thanks in advance!
Attachments
Issue Links
| This issue will be resolved by: | ||||
| MDL-14934 | Reports/logs download in Excel format shows wrong time. |
|
|
|
I have made a patch to fix the problem reported. To apply the patch please use:
cd moodle
patch
p0 < patchMDL-18394.diffThe patch is made against the current cvs MOODLE_19_WEEKLY.
The reports use the userdate() function to display the log date and time in the html page and in the text version of the report. However, in the print_log_xls() function the UNIX timestamp is simply adjusted to be an "excel timestamp" (starting from 1/1/1900). Based on reading some info about excel time, I couldn't find any info about their support for timezones. I tried OpenOffice Spreadsheet > format cell, still no notion of timezones.
Thus, my solution is to do something similar to what's done inside the userdate() function. I adjust the timestamp to include the user-defined timezone (or server timezone).
Additionally, I have changed the format of the date to be the same as in the html/text reports.
p0 < patchMDL-18394.diff The patch is made against the current cvs MOODLE_19_WEEKLY. The reports use the userdate() function to display the log date and time in the html page and in the text version of the report. However, in the print_log_xls() function the UNIX timestamp is simply adjusted to be an "excel timestamp" (starting from 1/1/1900). Based on reading some info about excel time, I couldn't find any info about their support for timezones. I tried OpenOffice Spreadsheet > format cell, still no notion of timezones. Thus, my solution is to do something similar to what's done inside the userdate() function. I adjust the timestamp to include the user-defined timezone (or server timezone). Additionally, I have changed the format of the date to be the same as in the html/text reports.