當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TimeDate::getUserTimeZone方法代碼示例

本文整理匯總了PHP中TimeDate::getUserTimeZone方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimeDate::getUserTimeZone方法的具體用法?PHP TimeDate::getUserTimeZone怎麽用?PHP TimeDate::getUserTimeZone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TimeDate的用法示例。


在下文中一共展示了TimeDate::getUserTimeZone方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetUserSettings

 /**
  * test fetching user settings
  */
 public function testGetUserSettings()
 {
     $this->_setPrefs('d/m/Y', 'h:i:sA', "America/Lima");
     $this->assertEquals('dd/mm/yyyy', $this->time_date->get_user_date_format());
     //FIXME: $this->assertEquals('11:00:00PM', $this->time_date->get_user_time_format());
     $tz = $this->time_date->getUserTimeZone();
     $this->assertEquals(-300, $tz["gmtOffset"]);
     //		$this->assertEquals(60, $tz["dstOffset"]);
 }
開發者ID:nickpro,項目名稱:sugarcrm_dev,代碼行數:12,代碼來源:TimeDateTest.php

示例2: getUserConfigJSON

function getUserConfigJSON()
{
    require_once 'include/TimeDate.php';
    $td = new TimeDate();
    global $current_user, $global_registry_var_name, $json, $_SESSION, $sugar_config;
    if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') {
        $theme = $_SESSION['authenticated_user_theme'];
    } else {
        $theme = $sugar_config['default_theme'];
    }
    $user_arr = array();
    $user_arr['theme'] = $theme;
    $user_arr['fields'] = array();
    $user_arr['module'] = 'User';
    $user_arr['fields']['id'] = $current_user->id;
    $user_arr['fields']['user_name'] = $current_user->user_name;
    $user_arr['fields']['first_name'] = $current_user->first_name;
    $user_arr['fields']['last_name'] = $current_user->last_name;
    $user_arr['fields']['email'] = $current_user->email1;
    $userTz = $td->getUserTimeZone();
    $dstRange = $td->getDSTRange(date('Y'), $userTz);
    $user_arr['fields']['dst_start'] = $dstRange['start'];
    $user_arr['fields']['dst_end'] = $dstRange['end'];
    $user_arr['fields']['gmt_offset'] = $userTz['gmtOffset'];
    $str = "\n" . $global_registry_var_name . ".current_user = " . $json->encode($user_arr) . ";\n";
    return $str;
}
開發者ID:BackupTheBerlios,項目名稱:livealphaprint,代碼行數:27,代碼來源:json_server.php


注:本文中的TimeDate::getUserTimeZone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。