当前位置: 首页>>代码示例>>PHP>>正文


PHP date_timezone_set函数代码示例

本文整理汇总了PHP中date_timezone_set函数的典型用法代码示例。如果您正苦于以下问题:PHP date_timezone_set函数的具体用法?PHP date_timezone_set怎么用?PHP date_timezone_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了date_timezone_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAttributes

 public function getAttributes($nameId, $spid, $attributes = array())
 {
     // Generate API key
     $time = new \DateTime();
     date_timezone_set($time, new \DateTimeZone('UTC'));
     $stamp = $time->format('Y-m-d H:i');
     $apiKey = hash('sha256', $this->as_config['hexaa_master_secret'] . $stamp);
     // Make the call
     // The data to send to the API
     $postData = array("apikey" => $apiKey, "fedid" => $nameId, "entityid" => $spid);
     // Setup cURL
     $ch = curl_init($this->as_config['hexaa_api_url'] . '/attributes.json');
     curl_setopt_array($ch, array(CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POSTFIELDS => json_encode($postData), CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_POSTREDIR => 3));
     // Send the request
     $response = curl_exec($ch);
     $http_response = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     // Check for error; not even redirects are allowed here
     if ($response === FALSE || !($http_response >= 200 && $http_response < 300)) {
         SimpleSAML_Logger::error('[aa] HEXAA API query failed: HTTP response code: ' . $http_response . ', curl error: "' . curl_error($ch)) . '"';
         SimpleSAML_Logger::debug('[aa] HEXAA API query failed: curl info: ' . var_export(curl_getinfo($ch), 1));
         SimpleSAML_Logger::debug('[aa] HEXAA API query failed: HTTP response: ' . var_export($response, 1));
         $data = array();
     } else {
         $data = json_decode($response, true);
         SimpleSAML_Logger::info('[aa] got reply from HEXAA API');
         SimpleSAML_Logger::debug('[aa] HEXAA API query postData: ' . var_export($postData, TRUE));
         SimpleSAML_Logger::debug('[aa] HEXAA API query result: ' . var_export($data, TRUE));
     }
     return $data;
 }
开发者ID:niif,项目名称:simplesamlphp-module-hexaa,代码行数:30,代码来源:Hexaa.php

示例2: translate

 /**
  * Translates a date from one timezone to a date of this timezone.
  * The value of the date is not changed by this operation.
  *
  * @param   util.Date date
  * @return  util.Date
  */
 public function translate(Date $date)
 {
     $handle = clone $date->getHandle();
     date_timezone_set($handle, $this->tz);
     return new Date($handle);
 }
开发者ID:xp-framework,项目名称:core,代码行数:13,代码来源:TimeZone.class.php

示例3: userAdjust

 /**
  * Used by date() and time() to adjust the time output.
  *
  * @param $ts Int the time in date('YmdHis') format
  * @param $tz Mixed: adjust the time by this amount (default false, mean we
  *            get user timecorrection setting)
  * @return int
  */
 function userAdjust($ts, $tz = false)
 {
     global $wgUser, $wgLocalTZoffset;
     if ($tz === false) {
         $tz = $wgUser->getOption('timecorrection');
     }
     $data = explode('|', $tz, 3);
     if ($data[0] == 'ZoneInfo') {
         wfSuppressWarnings();
         $userTZ = timezone_open($data[2]);
         wfRestoreWarnings();
         if ($userTZ !== false) {
             $date = date_create($ts, timezone_open('UTC'));
             date_timezone_set($date, $userTZ);
             $date = date_format($date, 'YmdHis');
             return $date;
         }
         # Unrecognized timezone, default to 'Offset' with the stored offset.
         $data[0] = 'Offset';
     }
     $minDiff = 0;
     if ($data[0] == 'System' || $tz == '') {
         #  Global offset in minutes.
         if (isset($wgLocalTZoffset)) {
             $minDiff = $wgLocalTZoffset;
         }
     } elseif ($data[0] == 'Offset') {
         $minDiff = intval($data[1]);
     } else {
         $data = explode(':', $tz);
         if (count($data) == 2) {
             $data[0] = intval($data[0]);
             $data[1] = intval($data[1]);
             $minDiff = abs($data[0]) * 60 + $data[1];
             if ($data[0] < 0) {
                 $minDiff = -$minDiff;
             }
         } else {
             $minDiff = intval($data[0]) * 60;
         }
     }
     # No difference ? Return time unchanged
     if (0 == $minDiff) {
         return $ts;
     }
     wfSuppressWarnings();
     // E_STRICT system time bitching
     # Generate an adjusted date; take advantage of the fact that mktime
     # will normalize out-of-range values so we don't have to split $minDiff
     # into hours and minutes.
     $t = mktime((int) substr($ts, 8, 2), (int) substr($ts, 10, 2) + $minDiff, (int) substr($ts, 12, 2), (int) substr($ts, 4, 2), (int) substr($ts, 6, 2), (int) substr($ts, 0, 4));
     # Year
     $date = date('YmdHis', $t);
     wfRestoreWarnings();
     return $date;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:64,代码来源:Language.php

示例4: session_start

<?php

/**
 * 我的MVC框架入口
 * 在这里进行路由分发,定位到Contrller控制器中
 */
session_start();
header("Content-type:text/html;charset=utf-8");
date_timezone_set("Asia/Shanghai");
//定义全局变量
define('WEB_ROOT', dirname(__FILE__));
define('APP_PATH', str_replace($_SERVER['DOCUMENT_ROOT'], '', WEB_ROOT));
define('CSS_PATH', APP_PATH . '/View/css');
define('JS_PATH', APP_PATH . '/View/js');
define('IMG_PATH', APP_PATH . '/View/images');
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', 'shao');
//新建Smarty类
require_once "Libs/Smarty/Smarty.class.php";
$objSmarty = new Smarty();
$objSmarty->template_dir = "View/templates/";
$objSmarty->compile_dir = "View/templates_c/";
$objSmarty->cache_dir = "View/cache/";
$objSmarty->left_delimiter = "{*";
$objSmarty->right_delimiter = "*}";
$objSmarty->assign('app_path', APP_PATH);
$objSmarty->assign('css_path', CSS_PATH);
$objSmarty->assign('js_path', JS_PATH);
$objSmarty->assign('img_path', IMG_PATH);
//包含Controller基类
开发者ID:shaopengwei,项目名称:my_own_mvc,代码行数:31,代码来源:index.php

示例5: timezoneConverter

function timezoneConverter($sType, $timestamp, $timezone)
{
    if ($sType == "N") {
        $date = date_create($timestamp, timezone_open("GMT"));
        $t1 = date_format($date, "Y-m-d H:i:s");
        date_timezone_set($date, timezone_open($timezone));
        $t2 = date_format($date, "Y-m-d H:i:s");
    } else {
        $date = date_create($timestamp, timezone_open($timezone));
        $t2 = date_format($date, "Y-m-d H:i:s");
        $gD = date_timezone_set($date, timezone_open("GMT"));
        $t1 = date_format($gD, "Y-m-d H:i:s");
    }
    return $t1 . SEPARATOR . $t2;
}
开发者ID:sushritcode,项目名称:emsrepo,代码行数:15,代码来源:client_db_function.inc.php

示例6: date_timezone_set

<?php

/* Prototype  : DateTime date_timezone_set  ( DateTime $object  , DateTimeZone $timezone  )
 * Description: Sets the time zone for the DateTime object
 * Source code: ext/date/php_date.c
 * Alias to functions: DateTime::setTimezone
 */
echo "*** Testing date_timezone_set() : basic functionality ***\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
$datetime = date_create("2009-01-30 17:57:32");
$tz = date_timezone_get($datetime);
echo "Default timezone: " . timezone_name_get($tz) . "\n";
$datetime = date_create("2009-01-30 22:57:32");
$la_time = timezone_open("America/Los_Angeles");
date_timezone_set($datetime, $la_time);
$tz = date_timezone_get($datetime);
echo "New timezone: " . timezone_name_get($tz) . "\n";
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:date_timezone_set_basic1.php

示例7: date_repeat_rrule_description

 /**
  * Build a description of an iCal rule.
  *
  * Constructs a human-readable description of the rule.
  */
 function date_repeat_rrule_description($rrule, $format = 'D M d Y')
 {
     // Empty or invalid value.
     if (empty($rrule) || !strstr($rrule, 'RRULE')) {
         return;
     }
     // Make sure there will be an empty description for any unused parts.
     $description = array('!interval' => '', '!byday' => '', '!bymonth' => '', '!count' => '', '!until' => '', '!except' => '', '!additional' => '', '!week_starts_on' => '');
     $parts = self::date_repeat_split_rrule($rrule);
     $additions = $parts[2];
     $exceptions = $parts[1];
     $rrule = $parts[0];
     $interval = self::INTERVAL_options();
     switch ($rrule['FREQ']) {
         case 'WEEKLY':
             $description['!interval'] = format_plural($rrule['INTERVAL'], 'every week', 'every @count weeks') . ' ';
             break;
         case 'MONTHLY':
             $description['!interval'] = format_plural($rrule['INTERVAL'], 'every month', 'every @count months') . ' ';
             break;
         case 'YEARLY':
             $description['!interval'] = format_plural($rrule['INTERVAL'], 'every year', 'every @count years') . ' ';
             break;
         default:
             $description['!interval'] = format_plural($rrule['INTERVAL'], 'every day', 'every @count days') . ' ';
             break;
     }
     if (!empty($rrule['BYDAY'])) {
         $days = date_repeat_dow_day_options();
         $counts = date_repeat_dow_count_options();
         $results = array();
         foreach ($rrule['BYDAY'] as $byday) {
             $day = substr($byday, -2);
             $count = intval(str_replace(' ' . $day, '', $byday));
             if ($count = intval(str_replace(' ' . $day, '', $byday))) {
                 $results[] = trim(t('!repeats_every_interval on the !date_order !day_of_week', array('!repeats_every_interval ' => '', '!date_order' => strtolower($counts[substr($byday, 0, 2)]), '!day_of_week' => $days[$day])));
             } else {
                 $results[] = trim(t('!repeats_every_interval every !day_of_week', array('!repeats_every_interval ' => '', '!day_of_week' => $days[$day])));
             }
         }
         $description['!byday'] = implode(' ' . t('and') . ' ', $results);
     }
     if (!empty($rrule['BYMONTH'])) {
         if (sizeof($rrule['BYMONTH']) < 12) {
             $results = array();
             $months = Yii::app()->getLocale()->getMonthNames();
             foreach ($rrule['BYMONTH'] as $month) {
                 $results[] = $months[$month];
             }
             if (!empty($rrule['BYMONTHDAY'])) {
                 $description['!bymonth'] = trim(t('!repeats_every_interval on the !month_days of !month_names', array('!repeats_every_interval ' => '', '!month_days' => implode(', ', $rrule['BYMONTHDAY']), '!month_names' => implode(', ', $results))));
             } else {
                 $description['!bymonth'] = trim(t('!repeats_every_interval on !month_names', array('!repeats_every_interval ' => '', '!month_names' => implode(', ', $results))));
             }
         }
     }
     if ($rrule['INTERVAL'] < 1) {
         $rrule['INTERVAL'] = 1;
     }
     if (!empty($rrule['COUNT'])) {
         $description['!count'] = trim(t('!repeats_every_interval !count times', array('!repeats_every_interval ' => '', '!count' => $rrule['COUNT'])));
     }
     if (!empty($rrule['UNTIL'])) {
         $until = date_ical_date($rrule['UNTIL'], 'UTC');
         date_timezone_set($until, date_default_timezone_object());
         $description['!until'] = trim(t('!repeats_every_interval until !until_date', array('!repeats_every_interval ' => '', '!until_date' => date_format_date($until, 'custom', $format))));
     }
     if ($exceptions) {
         $values = array();
         foreach ($exceptions as $exception) {
             $values[] = date_format_date(date_ical_date($exception), 'custom', $format);
         }
         $description['!except'] = trim(t('!repeats_every_interval except !except_dates', array('!repeats_every_interval ' => '', '!except_dates' => implode(', ', $values))));
     }
     if (!empty($rrule['WKST'])) {
         $day_names = date_repeat_dow_day_options();
         $description['!week_starts_on'] = trim(t('!repeats_every_interval where the week start on !day_of_week', array('!repeats_every_interval ' => '', '!day_of_week' => $day_names[trim($rrule['WKST'])])));
     }
     if ($additions) {
         $values = array();
         foreach ($additions as $addition) {
             $values[] = date_format_date(date_ical_date($addition), 'custom', $format);
         }
         $description['!additional'] = trim(t('Also includes !additional_dates.', array('!additional_dates' => implode(', ', $values))));
     }
     return t('Repeats !interval !bymonth !byday !count !until !except. !additional', $description);
 }
开发者ID:BGCX262,项目名称:zukunftemail-svn-to-git,代码行数:92,代码来源:EDateiCal.php

示例8: error_reporting

<?php

/*
 *
* Mysql database class - only one connection alowed
*/
error_reporting(1);
date_timezone_set("Asia/Singapore");
class Database
{
    private $_connection;
    private static $_instance;
    //The single instance
    private $_host = "127.0.0.1";
    private $_username = "maminasata";
    private $_password = "998877665544rfv";
    private $_database = "maminasata";
    private $error = 0;
    /*
    Get an instance of the Database
    @return Instance
    */
    public static function getInstance()
    {
        if (!self::$_instance) {
            // If no instance then make one
            self::$_instance = new self();
        }
        return self::$_instance;
    }
    // Constructor
开发者ID:Fadhli12,项目名称:maminasata,代码行数:31,代码来源:connection.php

示例9: date_iso_week_range

/** 
 * Start and end dates for an ISO week.
 */
function date_iso_week_range($week, $year)
{
    // Get to the last ISO week of the previous year.
    $min_date = new DateObject($year - 1 . '-12-28 00:00:00');
    date_timezone_set($min_date, date_default_timezone_object());
    // Find the first day of the first ISO week in the year.
    date_modify($min_date, '+1 Monday');
    // Jump ahead to the desired week for the beginning of the week range.
    if ($week > 1) {
        date_modify($min_date, '+ ' . ($week - 1) . ' weeks');
    }
    // move forwards to the last day of the week
    $max_date = clone $min_date;
    date_modify($max_date, '+7 days');
    return array($min_date, $max_date);
}
开发者ID:BGCX262,项目名称:zukunftemail-svn-to-git,代码行数:19,代码来源:DateObject.php

示例10: render

 /**
  * {@inheritdoc}
  */
 public function render()
 {
     // @todo Move to $this->validate()
     if (empty($this->view->rowPlugin) || !$this->hasCalendarRowPlugin()) {
         debug('\\Drupal\\calendar\\Plugin\\views\\style\\CalendarStyle: The calendar row plugin is required when using the calendar style, but it is missing.');
         return;
     }
     if (!($argument = CalendarHelper::getDateArgumentHandler($this->view))) {
         debug('\\Drupal\\calendar\\Plugin\\views\\style\\CalendarStyle: A calendar date argument is required when using the calendar style, but it is missing or is not using the default date.');
         return;
     }
     if (!$argument->validateValue()) {
         if (!$argument->getDateArg()->getValue()) {
             $msg = 'No calendar date argument value was provided.';
         } else {
             $msg = t('The value <strong>@value</strong> is a valid date argument for @granularity', ['@value' => $argument->getDateArg()->getValue(), '@granularity' => $argument->getGranularity()]);
         }
         drupal_set_message($msg, 'error');
         return;
     }
     // Add information from the date argument to the view.
     $this->dateInfo->setGranularity($argument->getGranularity());
     $this->dateInfo->setCalendarType($this->options['calendar_type']);
     $this->dateInfo->setDateArgument($argument->getDateArg());
     $this->dateInfo->setMinYear($argument->getMinDate()->format('Y'));
     $this->dateInfo->setMinMonth($argument->getMinDate()->format('n'));
     $this->dateInfo->setMinDay($argument->getMinDate()->format('j'));
     // @todo We shouldn't use DATETIME_DATE_STORAGE_FORMAT.
     $this->dateInfo->setMinWeek(CalendarHelper::dateWeek(date_format($argument->getMinDate(), DATETIME_DATE_STORAGE_FORMAT)));
     //$this->dateInfo->setRange($argument->options['calendar']['date_range']);
     $this->dateInfo->setMinDate($argument->getMinDate());
     $this->dateInfo->setMaxDate($argument->getMaxDate());
     // @todo implement limit
     //    $this->dateInfo->limit = $argument->limit;
     // @todo What if the display doesn't have a route?
     //$this->dateInfo->url = $this->view->getUrl();
     $this->dateInfo->setForbid(isset($argument->getDateArg()->forbid) ? $argument->getDateArg()->forbid : FALSE);
     // Add calendar style information to the view.
     $this->styleInfo->setCalendarPopup($this->displayHandler->getOption('calendar_popup'));
     $this->styleInfo->setNameSize($this->options['name_size']);
     $this->styleInfo->setMini($this->options['mini']);
     $this->styleInfo->setShowWeekNumbers($this->options['with_weekno']);
     $this->styleInfo->setMultiDayTheme($this->options['multiday_theme']);
     $this->styleInfo->setThemeStyle($this->options['theme_style']);
     $this->styleInfo->setMaxItems($this->options['max_items']);
     $this->styleInfo->setMaxItemsStyle($this->options['max_items_behavior']);
     if (!empty($this->options['groupby_times_custom'])) {
         $this->styleInfo->setGroupByTimes(explode(',', $this->options['groupby_times_custom']));
     } else {
         $this->styleInfo->setGroupByTimes(calendar_groupby_times($this->options['groupby_times']));
     }
     $this->styleInfo->setCustomGroupByField($this->options['groupby_field']);
     // TODO make this an option setting.
     $this->styleInfo->setShowEmptyTimes(!empty($this->options['groupby_times_custom']) ? TRUE : FALSE);
     // Set up parameters for the current view that can be used by the row plugin.
     $display_timezone = date_timezone_get($this->dateInfo->getMinDate());
     $this->dateInfo->setTimezone($display_timezone);
     // @TODO min and max date timezone info shouldn't be stored separately.
     $date = clone $this->dateInfo->getMinDate();
     date_timezone_set($date, $display_timezone);
     //    $this->dateInfo->min_zone_string = date_format($date, DATETIME_DATE_STORAGE_FORMAT);
     $date = clone $this->dateInfo->getMaxDate();
     date_timezone_set($date, $display_timezone);
     //    $this->dateInfo->max_zone_string = date_format($date, DATETIME_DATE_STORAGE_FORMAT);
     // Let views render fields the way it thinks they should look before we
     // start massaging them.
     $this->renderFields($this->view->result);
     // Invoke the row plugin to massage each result row into calendar items.
     // Gather the row items into an array grouped by date and time.
     $items = [];
     foreach ($this->view->result as $row_index => $row) {
         $this->view->row_index = $row_index;
         $events = $this->view->rowPlugin->render($row);
         // @todo Check what comes out here.
         /** @var \Drupal\calendar\CalendarEvent $event_info */
         foreach ($events as $event_info) {
             //        $event->granularity = $this->dateInfo->granularity;
             $item_start = $event_info->getStartDate()->format('Y-m-d');
             $item_end = $event_info->getEndDate()->format('Y-m-d');
             $time_start = $event_info->getStartDate()->format('H:i:s');
             $event_info->setRenderedFields($this->rendered_fields[$row_index]);
             $items[$item_start][$time_start][] = $event_info;
         }
     }
     ksort($items);
     $rows = [];
     $this->currentDay = clone $this->dateInfo->getMinDate();
     $this->items = $items;
     // Retrieve the results array using a the right method for the granularity of the display.
     switch ($this->options['calendar_type']) {
         case 'year':
             $rows = [];
             $this->styleInfo->setMini(TRUE);
             for ($i = 1; $i <= 12; $i++) {
                 $rows[$i] = $this->calendarBuildMiniMonth();
             }
             $this->styleInfo->setMini(FALSE);
//.........这里部分代码省略.........
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:101,代码来源:Calendar.php

示例11: format_date

function format_date($date)
{
    //Change date format to: December 7th, 6:00PM Pacific time
    $date = date_create($date);
    $date_timezone = date_timezone_set($date, timezone_open("America/Los_angeles"));
    $formatted_date = date_format($date_timezone, "F jS, g:iA");
    return $formatted_date;
}
开发者ID:rosemarylp,项目名称:canvas_dash,代码行数:8,代码来源:functions.inc.php

示例12: date_default_timezone_set

<?php

/* Prototype  : DateTime date_timezone_set  ( DateTime $object  , DateTimeZone $timezone  )
 * Description: Sets the time zone for the DateTime object
 * Source code: ext/date/php_date.c
 * Alias to functions: DateTime::setTimezone
 */
date_default_timezone_set("UTC");
echo "*** Testing date_timezone_set() : error conditions ***\n";
echo "\n-- Testing date_timezone_set() function with zero arguments --\n";
var_dump(date_timezone_set());
echo "\n-- Testing date_timezone_set() function with less than expected no. of arguments --\n";
$datetime = date_create("2009-01-30 17:57:32");
var_dump(date_timezone_set($datetime));
echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n";
$timezone = timezone_open("GMT");
$extra_arg = 99;
var_dump(date_timezone_set($datetime, $timezone, $extra_arg));
echo "\n-- Testing date_timezone_set() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
var_dump(date_timezone_set($invalid_obj, $timezone));
$invalid_obj = 10;
var_dump(date_timezone_set($invalid_obj, $timezone));
$invalid_obj = null;
var_dump(date_timezone_set($invalid_obj, $timezone));
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:date_timezone_set_error.php

示例13: create

 /**
  * Construct a date object out of it's time values If a timezone string
  * the date will be set into that zone - defaulting to the system's
  * default timezone of none is given.
  *
  * @param   int year
  * @param   int month
  * @param   int day
  * @param   int hour
  * @param   int minute
  * @param   int second
  * @param   util.TimeZone tz default NULL
  * @return  util.Date
  */
 public static function create($year, $month, $day, $hour, $minute, $second, TimeZone $tz = null)
 {
     $date = date_create();
     if ($tz) {
         date_timezone_set($date, $tz->getHandle());
     }
     if (false === @date_date_set($date, $year, $month, $day) || false === @date_time_set($date, $hour, $minute, $second)) {
         throw new IllegalArgumentException(sprintf('One or more given arguments are not valid: $year=%s, $month=%s, $day= %s, $hour=%s, $minute=%s, $second=%s', $year, $month, $day, $hour, $minute, $second));
     }
     return new self($date);
 }
开发者ID:johannes85,项目名称:core,代码行数:25,代码来源:Date.class.php

示例14: t

    ?>
    </div> <!-- /committee-updates-description -->
    <div class="committee-updates-right-infobox">
      <div class="field field-type-date field-field-date">
        <div class="field-items">
          <div class="field-item">
            <label><?php 
    print t('Meeting Schedule');
    ?>
:</label>
            <?php 
    $from_date = date_make_date($node->field_date[0]['value'], 'UTC');
    date_timezone_set($from_date, timezone_open(date_get_timezone('site')));
    // Fix timezone
    $to_date = date_make_date($node->field_date[0]['value2'], 'UTC');
    date_timezone_set($to_date, timezone_open(date_get_timezone('site')));
    // Fix timezone
    $from_date_string = date_format_date($from_date, 'custom', 'F j');
    $from_time_string = date_format_date($from_date, 'custom', 'g:i A');
    $to_date_string = date_format_date($to_date, 'custom', 'F j');
    $to_time_string = date_format_date($to_date, 'custom', 'g:i A');
    if ($from_date_string == $to_date_string) {
        print '<span class="date-display-start">' . "{$from_date_string}, {$from_time_string}" . '</span><span class="date-display-separator"> - </span><span class="date-display-end">' . $to_time_string . '</span>';
    } else {
        print '<span class="date-display-start">' . "{$from_date_string}, {$from_time_string}" . '</span><span class="date-display-separator"> - </span><span class="date-display-end">' . "{$to_date_string}, {$to_time_string}" . '</span>';
    }
    ?>
<br />
            <?php 
    print l(t('Read more...'), 'node/' . $node->nid);
    ?>
开发者ID:nysenate,项目名称:NYSenate.gov-Website-2009,代码行数:31,代码来源:node-view-senator_content_types.tpl.php

示例15: ical_date

 /**
  * Return a date object for the ical date, adjusted to its local timezone.
  *
  * @param array $ical_date
  *   An array of ical date information created in the ical import.
  * @param string $to_tz
  *   The timezone to convert the date's value to.
  *
  * @return object
  *   A timezone-adjusted date object.
  */
 public static function ical_date($ical_date, $to_tz = FALSE)
 {
     // If the ical date has no timezone, must assume it is stateless
     // so treat it as a local date.
     if (empty($ical_date['datetime'])) {
         return NULL;
     } elseif (empty($ical_date['tz'])) {
         $from_tz = drupal_get_user_timezone();
     } else {
         $from_tz = $ical_date['tz'];
     }
     if (strlen($ical_date['datetime']) < 11) {
         $ical_date['datetime'] .= ' 00:00:00';
     }
     $date = new DrupalDateTime($ical_date['datetime'], new \DateTimeZone($from_tz));
     if ($to_tz && $ical_date['tz'] != '' && $to_tz != $ical_date['tz']) {
         date_timezone_set($date, timezone_open($to_tz));
     }
     return $date;
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:31,代码来源:DateiCalParse.php


注:本文中的date_timezone_set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。