]>
git.datanom.net - webcal.git/blob - utils/dateformat.class.php
75ebb45f608ad74628a23c616cdba57bbd94cd3c
3 include_once 'config.inc.php';
4 require_once 'helper.php';
9 function __construct($tz = '') {
11 $tz = ($_SESSION['user_settings']->getTimeZone() !== NULL) ?
12 $_SESSION['user_settings']->getTimeZone() : TIMEZONE;
14 $timezone = date_default_timezone_get();
15 $tz_server = date("Z")/3600;
16 date_default_timezone_set($tz);
17 $tz_client = date("Z")/3600;
18 date_default_timezone_set($timezone);
19 $this->tz = $tz_client - $tz_server;
20 print "$timezone:$tz_server:$tz_client<br/>";
23 public function client2UTC($datetime) {
24 if (strcasecmp(substr($datetime, -1), "Z") === 0) {
25 // Time is in UTC already
29 $timestamp = strtotime($datetime);
31 return gmdate("Ymd\THis\Z", $timestamp);
34 public function UTC2Client($datetime) {
35 //print "UTC2Client: $datetime\n";
36 if (strcasecmp(substr($datetime, -1), "Z") !== 0) {
41 $timestamp = strtotime($datetime);
43 return date("Ymd\THis", $timestamp);
46 public function UTC2Local($datetime) {
47 if (strcasecmp(substr($datetime, -1), "Z") !== 0) {
52 $offset = $_SESSION['timezone_offset'] - date("Z");
53 $timestamp = strtotime($datetime) +
$offset;
55 return date("Ymd\THis", $timestamp);
This page took 0.097582 seconds and 6 git commands to generate.