diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-06-05 15:13:03 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-06-05 15:13:03 +0200 |
commit | d65f8bba73971e33a93e99d21ba791dec8056a28 (patch) | |
tree | c2d6c44d1a1b79849787ccc6d738c071e659421d /lib | |
parent | bc0790381e9cf02545bf4b2945c70c246008671f (diff) | |
download | nextcloud-server-d65f8bba73971e33a93e99d21ba791dec8056a28.tar.gz nextcloud-server-d65f8bba73971e33a93e99d21ba791dec8056a28.zip |
try to adjust times to the clients timezone
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php index c18ecd570db..a3ffb6b1a6f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -231,8 +231,15 @@ class OC_UTIL { * @param bool dateOnly option to ommit time from the result */ public static function formatDate( $timestamp,$dateOnly=false){ - $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; - return date($timeformat,$timestamp); + if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it + $systemTimeZone = intval(exec('date +%z')); + $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); + $clientTimeZone=$_SESSION['timezone']*60; + $offset=$clientTimeZone-$systemTimeZone; + $timestamp=$timestamp+$offset*60; + } + $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; + return date($timeformat,$timestamp); } /** |