Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'm20_MDL-14934_excel_time' of github.com:dongsheng/moodle

  • Loading branch information...
commit 011c956ba14ab69d20d404e13a36c5608ea7b250 2 parents 8128404 + 869bbb3
@stronk7 stronk7 authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/excellib.class.php
View
8 lib/excellib.class.php
@@ -212,7 +212,13 @@ function write_date($row, $col, $date, $format=null) {
$format = $this->MoodleExcelFormat2PearExcelFormat($format);
/// Convert the date to Excel format
$timezone = get_user_timezone_offset();
- $value = ((usertime($date) + (int)($timezone * HOURSECS * 2)) / 86400) + 25569;
+ if ($timezone == 99) {
+ // system timezone offset in seconds
+ $offset = (int)date('Z');
+ } else {
+ $offset = (int)($timezone * HOURSECS * 2);
+ }
+ $value = ((usertime($date) + $offset) / 86400) + 25569;
/// Add the date safely to the PEAR Worksheet
$this->pear_excel_worksheet->writeNumber($row, $col, $value, $format);
}
Please sign in to comment.
Something went wrong with that request. Please try again.