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


PHP date_offset_get函数代码示例

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


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

示例1: humanize

 /**
  * Returns human readable date.
  * 
  * Set the offset to the system offset as the dates returned by the 
  * cache keys are not GMT. 
  *
  * @param  array   An optional array with configuration options.
  * @return string  Formatted date.
  */
 public function humanize($config = array())
 {
     $config = new KConfig($config);
     $config->append(array(
         'gmt_offset'  => date_offset_get(new DateTime)
     ));
     
    return parent::humanize($config);
 }
开发者ID:raeldc,项目名称:com_learn,代码行数:18,代码来源:date.php

示例2: humanize

 /**
  * Returns human readable date.
  *
  * @param  array   An optional array with configuration options.
  * @return string  Formatted date.
  */
 public function humanize($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('date' => null, 'gmt_offset' => date_offset_get(new DateTime()), 'smallest_period' => 'second'));
     $periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year');
     $lengths = array(60, 60, 24, 7, 4.35, 12, 10);
     $now = strtotime(gmdate("M d Y H:i:s"));
     $time = is_numeric($config->date) ? $config->date : strtotime($config->date);
     if ($time) {
         if ($config->gmt_offset != 0) {
             $now = $now + $config->gmt_offset;
         }
         if ($now != $time) {
             if ($now > $time) {
                 $difference = $now - $time;
                 $tense = 'ago';
             } else {
                 $difference = $time - $now;
                 $tense = 'from now';
             }
             for ($i = 0; $difference >= $lengths[$i] && $i < 6; $i++) {
                 $difference /= $lengths[$i];
             }
             $difference = round($difference);
             $period_index = array_search($config->smallest_period, $periods);
             $omitted_periods = $periods;
             array_splice($omitted_periods, $period_index);
             if (in_array($periods[$i], $omitted_periods)) {
                 $difference = 1;
                 $i = $period_index;
             }
             if ($periods[$i] == 'day') {
                 switch ($difference) {
                     case 1:
                         return 'Today';
                         break;
                     case 2:
                         return $tense == 'ago' ? 'Yesterday' : 'Tomorrow';
                         break;
                 }
             }
             if ($difference != 1) {
                 $periods[$i] .= 's';
             }
             $result = sprintf(JText::_('%s ' . $periods[$i] . ' ' . $tense), $difference);
         } else {
             $result = JText::_('Now');
         }
     } else {
         $result = JText::_('Never');
     }
     return $result;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:59,代码来源:date.php

示例3: humanize

 /**
  * Returns human readable date.
  *
  * @param  array   An optional array with configuration options.
  * @return string  Formatted date.
  */
 public function humanize($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('date' => null, 'gmt_offset' => date_offset_get(new DateTime()), 'smallest_period' => 'second'));
     $periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year');
     $lengths = array(60, 60, 24, 7, 4.35, 12, 10);
     $now = strtotime(gmdate("M d Y H:i:s"));
     $time = is_numeric($config->date) ? $config->date : strtotime($config->date);
     if ($time) {
         if ($config->gmt_offset != 0) {
             $now = $now + $config->gmt_offset;
         }
         if ($now != $time) {
             if ($now > $time) {
                 $difference = $now - $time;
                 $tense = 'ago';
             } else {
                 $difference = $time - $now;
                 $tense = 'from now';
             }
             for ($i = 0; $difference >= $lengths[$i] && $i < 6; $i++) {
                 $difference /= $lengths[$i];
             }
             $difference = round($difference);
             $period_index = array_search($config->smallest_period, $periods);
             $omitted_periods = $periods;
             array_splice($omitted_periods, $period_index);
             if (in_array($periods[$i], $omitted_periods)) {
                 $difference = 1;
                 $i = $period_index;
             }
             if ($periods[$i] == 'day' && $difference == 1) {
                 // Since we got 1 by rounding it down and if it's less than 24 hours it would say x hours ago, this is yesterday
                 return $tense == 'ago' ? $this->translate('Yesterday') : $this->translate('Tomorrow');
             }
             $period = $periods[$i];
             $period_plural = $period . 's';
             // We do not pass $period or $tense as parameters to replace because
             // some languages use different words for them based on the time difference.
             $translator = $this->getTemplate()->getHelper('translator')->getTranslator();
             $result = $translator->choose(array("%number% {$period} {$tense}", "%number% {$period_plural} {$tense}"), $difference, array('%number%' => $difference));
         } else {
             $result = $this->translate('Just now');
         }
     } else {
         $result = $this->translate('Never');
     }
     return $result;
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:55,代码来源:date.php

示例4: nicetime

function nicetime($posted_date, $admin = false, $nohour = false)
{
    // Adapted for something found on Internet, but I forgot to keep the url...
    $act_opt = get_option('act_settings');
    $date_relative = $act_opt['act_date_relative'];
    $date_format = $act_opt['act_date_format'];
    $gmt_offset = get_option('gmt_offset');
    if (empty($gmt_offset) and $gmt_offset != 0) {
        $timezone = get_option('timezone_string');
        $gmt = date_create($posted_date, timezone_open($timezone));
        $gmt_offset = date_offset_get($gmt) / 3600;
    }
    /*$cur_time_gmt = current_time('timestamp', true);
      $posted_date = gmdate("Y-m-d H:i:s", strtotime($posted_date) + ($gmt_offset * 3600));
      $in_seconds = strtotime($posted_date);*/
    $cur_time_gmt = time();
    $in_seconds = strtotime($posted_date);
    $posted_date = gmdate("Y-m-d H:i:s", strtotime($posted_date) + $gmt_offset * 3600);
    $relative_date = '';
    $diff = $cur_time_gmt - $in_seconds;
    $months = floor($diff / 2592000);
    $diff -= $months * 2419200;
    $weeks = floor($diff / 604800);
    $diff -= $weeks * 604800;
    $days = floor($diff / 86400);
    $diff -= $days * 86400;
    $hours = floor($diff / 3600);
    $diff -= $hours * 3600;
    $minutes = floor($diff / 60);
    $diff -= $minutes * 60;
    $seconds = $diff;
    if ($months > 0 or !$date_relative or $admin) {
        // over a month old, just show date
        if ((!$date_relative or $admin) and !$nohour) {
            $h = substr($posted_date, 10);
        } else {
            $h = '';
        }
        switch ($date_format) {
            case 'dd/mm/yyyy':
                return substr($posted_date, 8, 2) . '/' . substr($posted_date, 5, 2) . '/' . substr($posted_date, 0, 4) . $h;
                break;
            case 'mm/dd/yyyy':
                return substr($posted_date, 5, 2) . '/' . substr($posted_date, 8, 2) . '/' . substr($posted_date, 0, 4) . $h;
                break;
            case 'yyyy/mm/dd':
            default:
                return substr($posted_date, 0, 4) . '/' . substr($posted_date, 5, 2) . '/' . substr($posted_date, 8, 2) . $h;
                break;
        }
    } else {
        if ($weeks > 0) {
            // weeks and days
            $relative_date .= ($relative_date ? ', ' : '') . $weeks . ' ' . ($weeks > 1 ? __('weeks', 'wp-activity') : __('week', 'wp-activity'));
            $relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . ($days > 1 ? __('days', 'wp-activity') : __('day', 'wp-activity')) : '';
        } elseif ($days > 0) {
            // days and hours
            $relative_date .= ($relative_date ? ', ' : '') . $days . ' ' . ($days > 1 ? __('days', 'wp-activity') : __('day', 'wp-activity'));
            $relative_date .= $hours > 0 ? ($relative_date ? ', ' : '') . $hours . ' ' . ($hours > 1 ? __('hours', 'wp-activity') : __('hour', 'wp-activity')) : '';
        } elseif ($hours > 0) {
            // hours and minutes
            $relative_date .= ($relative_date ? ', ' : '') . $hours . ' ' . ($hours > 1 ? __('hours', 'wp-activity') : __('hour', 'wp-activity'));
            $relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '') . $minutes . ' ' . ($minutes > 1 ? __('minutes', 'wp-activity') : __('minute', 'wp-activity')) : '';
        } elseif ($minutes > 0) {
            // minutes only
            $relative_date .= ($relative_date ? ', ' : '') . $minutes . ' ' . ($minutes > 1 ? __('minutes', 'wp-activity') : __('minute', 'wp-activity'));
        } else {
            // seconds only
            $relative_date .= ($relative_date ? ', ' : '') . $seconds . ' ' . ($seconds > 1 ? __('seconds', 'wp-activity') : __('second', 'wp-activity'));
        }
    }
    // show relative date and add proper verbiage
    return sprintf(__('%s ago', 'wp-activity'), $relative_date);
}
开发者ID:ar-mohammadi,项目名称:cwr_cwrdiversity.org,代码行数:74,代码来源:wp-activity.php

示例5: getNHStateData

 function getNHStateData($stn = 'PLYMOUTH ARPRT')
 {
     $apline = -1;
     $infile = file("/web/temp/obs.txt");
     if ($infile) {
         foreach ($infile as $ob) {
             if (!stristr($ob, 'NEW HAMPSHIRE OBSERVATIONS') === FALSE) {
                 $timeline = $ob;
                 preg_match('/OBSERVATIONS for (.*)/', $ob, $matches);
                 $airport_data['observation_time'] = $matches[1];
             }
             if (!stristr($ob, $stn) === FALSE) {
                 $apline = $ob;
                 break;
             }
         }
     }
     if (($stn = 'PLYMOUTH ARPRT') && $apline == -1) {
         $stn = 'PLYMOUTH STATE';
         foreach ($infile as $ob) {
             if (!stristr($ob, 'KPLY') === FALSE) {
                 // Can't use Plymouth State as it is in the header
                 $apline = $ob;
                 break;
             }
         }
     }
     $airport_data['location'] = $stn == 'PLYMOUTH ARPRT' ? "Plymouth Airport" : ucwords($stn);
     $airport_data['location'] = $stn == 'PLYMOUTH STATE' ? "Plymouth State" : ucwords($stn);
     $airport_data['temp_f'] = trim(substr($apline, 17, 3));
     $airport_data['relative_humidity'] = trim(substr($apline, 25, 3));
     $airport_data['dewpoint_f'] = trim(substr($apline, 21, 3));
     $airport_data['wind_degrees'] = trim(substr($apline, 29, 3));
     $airport_data['wind_dir_abbrev'] = $this->get_wind_dir_abbrev($airport_data['wind_degrees']);
     $airport_data['latitude'] = 43.77;
     $airport_data['longitude'] = -71.75;
     $airport_data['tzoffset'] = date_offset_get(new DateTime()) / 3600 * 100;
     $airport_data['sunrise'] = $this->get_sundata("sunrise", $airport_data['latitude'], $airport_data['longitude'], $airport_data['tzoffset']);
     $airport_data['sunset'] = $this->get_sundata("sunset", $airport_data['latitude'], $airport_data['longitude'], $airport_data['tzoffset']);
     $airport_data['wind_mph'] = trim(substr($apline, 37, 2));
     $airport_data['new_wind_chill'] = $this->get_new_wind_chill($airport_data['temp_f'], $airport_data['wind_mph']);
     $airport_data['new_heat_index'] = $this->get_new_heat_index($airport_data['temp_f'], $airport_data['relative_humidity']);
     $airport_data['sky'] = trim(substr($apline, 66, 3));
     $airport_data['precip'] = trim(substr($apline, 69, 4));
     if (strlen($airport_data['precip']) > 0) {
         if (preg_match('/R/', $airport_data['precip'])) {
             $airport_data['weather'] = "rain";
         } else {
             if (preg_match('/S/', $airport_data['precip'])) {
                 $airport_data['weather'] = "snow";
             } else {
                 if (preg_match('/H/', $airport_data['precip'])) {
                     $airport_data['weather'] = "haze";
                 } else {
                     if (preg_match('/F/', $airport_data['precip'])) {
                         $airport_data['weather'] = "fog";
                     } else {
                         if (preg_match('/L/', $airport_data['precip'])) {
                             $airport_data['weather'] = "drizzle";
                         }
                     }
                 }
             }
         }
         if (preg_match('/-/', $airport_data['precip'])) {
             $airport_data['weather'] = "Lt. " . $airport_data['weather'];
         } else {
             if (preg_match('/\\+/', $data['precip'])) {
                 $airport_data['weather'] = "Hvy. " . $airport_data['weather'];
             }
         }
         $airport_data['wximg'] = $this->get_wximage('ob', $airport_data['weather'], $airport_data['latitude'], $airport_data['longitude'], true);
     } else {
         if (preg_match('/CLR/', $data['sky'])) {
             $data['weather'] = "clear";
         } else {
             if (preg_match('/FEW/', $airport_data['sky'])) {
                 $airport_data['weather'] = "fair";
             } else {
                 if (preg_match('/SCT/', $airport_data['sky'])) {
                     $airport_data['weather'] = "partly cloudy";
                 } else {
                     if (preg_match('/BKN/', $airport_data['sky'])) {
                         $airport_data['weather'] = "mostly cloudy";
                     } else {
                         if (preg_match('/OVC/', $airport_data['sky'])) {
                             $airport_data['weather'] = "overcast";
                         } else {
                             if (preg_match('/X/', $airport_data['sky'])) {
                                 $airport_data['weather'] = "obscur";
                             }
                         }
                     }
                 }
             }
         }
         $airport_data['wximg'] = $this->get_wximage('ob', $airport_data['weather'], $airport_data['latitude'], $airport_data['longitude'], false);
     }
     return $airport_data;
 }
开发者ID:AholibamaSI,项目名称:plymouth-webapp,代码行数:100,代码来源:weather.class.php

示例6: var_dump

{
    var_dump(date_format($dt, "Y-m-d H:i:s"));
}
format(date_create("2006-12-12"), "2006-12-12 00:00:00");
format(date_create("@1170288001"), "2007-02-01 00:00:01");
$dt = date_create("2006-12-12 12:34:56");
date_date_set($dt, 2007, 11, 23);
format($dt);
$dt = date_create("2008-08-08 00:00:00");
date_isodate_set($dt, 2007, 35, 3);
format($dt);
$dt = date_create("2006-12-12 00:00:00");
date_modify($dt, "+1 day");
format($dt);
var_dump(date_offset_get(date_create("2006-12-12")));
var_dump(date_offset_get(date_create("2008-08-08")));
$dt = date_create("2006-12-12 12:34:56");
date_time_set($dt, 23, 45, 12);
format($dt);
$d = strtotime("2008-09-10 12:34:56");
var_dump(date("l", $d));
var_dump(date("l jS \\of F Y h:i:s A", $d));
var_dump(date("l", mktime(0, 0, 0, 7, 1, 2000)));
var_dump(date(DATE_RFC822, $d));
var_dump(date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)));
var_dump(date("l \\t\\h\\e jS", $d));
$tomorrow = mktime(0, 0, 0, (int) date("m", $d), (int) date("d", $d) + 1, (int) date("Y", $d));
var_dump($tomorrow);
$lastmonth = mktime(0, 0, 0, (int) date("m", $d) - 1, (int) date("d", $d), (int) date("Y", $d));
var_dump($lastmonth);
$nextyear = mktime(0, 0, 0, (int) date("m", $d), (int) date("d", $d), (int) date("Y", $d) + 1);
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:date.php

示例7: gmstrtotime

/**
 * Convert a date string into a Unix timestamp.
 * Interpreteting the date string in GMT context (instead of the time zone currently
 * set with date_default_timezone_set in ./inc/init.php)
 *
 * Be careful not to use this function when working with non-dates
 * such as "1 minute ago". Those must be passed to strtotime() directly, otherwise offset
 * will be incorrectly offset applied. gmstrototime() is only to be used on actual dates
 * such as "2012-01-01 15:45:01".
 *
 * @since 1.0.0
 * @source php.net/strtotime#107773
 *
 * @param $time string
 * @param $now int
 * @return int Timestamp
 */
function gmstrtotime($time, $now = null)
{
    static $utc_offset = null;
    if ($utc_offset === null) {
        $utc_offset = date_offset_get(new DateTime());
    }
    if ($now === null) {
        $loctime = strtotime($time);
    } else {
        $loctime = strtotime($time, $now);
    }
    return $loctime + $utc_offset;
}
开发者ID:rhodblinkbox,项目名称:testswarm,代码行数:30,代码来源:utilities.php

示例8: var_dump

var_dump(timezone_name_get(date_timezone_get($dt)));
var_dump(date_format($dt, 'Y-m-d H:i:s'));
var_dump(timezone_name_from_abbr("CET"));
var_dump(timezone_name_from_abbr("", 3600, 0));
$tz = timezone_open("Asia/Shanghai");
var_dump(timezone_name_get($tz));
// Create two timezone objects, one for Taipei (Taiwan) and one for
// Tokyo (Japan)
$dateTimeZoneTaipei = timezone_open("Asia/Taipei");
$dateTimeZoneJapan = timezone_open("Asia/Tokyo");
// Create two DateTime objects that will contain the same Unix timestamp, but
// have different timezones attached to them.
$dateTimeTaipei = date_create("2008-08-08", $dateTimeZoneTaipei);
$dateTimeJapan = date_create("2008-08-08", $dateTimeZoneJapan);
var_dump(date_offset_get($dateTimeTaipei));
var_dump(date_offset_get($dateTimeJapan));
$tz = timezone_open("Asia/Shanghai");
var_dump(timezone_name_get($tz));
$timezone = timezone_open("CET");
$transitions = timezone_transitions_get($timezone);
var_dump($transitions[0]['ts']);
var_dump($transitions[0]['offset']);
var_dump($transitions[0]['isdst']);
var_dump($transitions[0]['abbr']);
$tz = timezone_open("EDT");
var_dump(timezone_name_get($tz));
$tz = timezone_open("PST");
var_dump(timezone_name_get($tz));
$tz = timezone_open("CHAST");
var_dump(timezone_name_get($tz));
var_dump((bool) timezone_version_get());
开发者ID:ezoic,项目名称:hhvm,代码行数:31,代码来源:date_timezone.php

示例9: timezone_offset

 /**
  * pass this a zone, and it passes back the seconds offset for the current time in that zone.
  */
 function timezone_offset($zone)
 {
     if (function_exists('date_offset_get') and function_exists('date_create') and function_exists('timezone_open')) {
         $offset = date_offset_get(date_create("now", timezone_open($zone)));
     } else {
         $old_tz = getenv('TZ');
         putenv("TZ={$zone}");
         $offset = date('Z', time());
         putenv("TZ={$old_tz}");
     }
     return $offset;
 }
开发者ID:AaronTRUngerboeck,项目名称:JoomlaTest,代码行数:15,代码来源:core.php

示例10: time

$majorTicks = $majorTicks * 1000;
$minorTicks = $majorTicks / 4;
$page = 0;
$g_canvas->header_left_text = $g_label;
$time = $_REQUEST["time"];
if (!$time) {
    if ($g_is_watchdog) {
        $time = $g_server->StartTime->getTime() / 1000;
    } else {
        $time = time() + 5;
    }
}
$g_end = $time;
$g_end_unadjusted = $g_end;
if (2 * DAY <= $period) {
    $tz = date_offset_get(new DateTime());
    $ticks_sec = $majorTicks / 1000;
    $g_end = ceil(($g_end + $tz) / $ticks_sec) * $ticks_sec - $tz;
}
$g_start = $g_end - $period;
$g_canvas->footer_left_text = date("Y-m-d H:i", $g_end);
$g_canvas->footer_right_text = date("Y-m-d H:i", $g_end);
$jmx_dump = pdf_load_json_dump("Resin|JmxDump", $g_start, $g_end);
if (!$jmx_dump) {
    // a JMX dump was not found, try to find an older one
    $jmx_dump = pdf_load_json_dump("Resin|JmxDump");
    if ($jmx_dump) {
        $timestamp = $jmx_dump["timestamp"] / 1000;
        array_push($g_pdf_warnings, "A saved JMX snapshot not was found in the selected data range.");
        array_push($g_pdf_warnings, "Using an earlier JMX snapshot from  " . date("Y-m-d H:i", $timestamp));
    }
开发者ID:am-immanuel,项目名称:quercus,代码行数:31,代码来源:pdf-gen.php

示例11: qi_timezone_select

/**
* Mostly borrowed from phpBB 3.1 includes/functions.php/phpbb_timezone_select()
* To have it available for 3.0.x too.
*
* Options to pick a timezone and date/time
*
* @param	\phpbb\template\template $template	phpBB template object
* @param	\phpbb\user	$user				Object of the current user
* @param	string		$default			A timezone to select
* @param	boolean		$truncate			Shall we truncate the options text
*
* @return		array		Returns an array containing the options for the time selector.
*/
function qi_timezone_select($user, $default = '', $truncate = false)
{
    date_default_timezone_set('UTC');
    $unsorted_timezones = DateTimeZone::listIdentifiers();
    $timezones = array();
    foreach ($unsorted_timezones as $timezone) {
        $tz = date_create(date('d M Y, H:i'), timezone_open($timezone));
        $offset = date_offset_get($tz);
        $current_time = date('d M Y, H:i', time() + $offset);
        $offset_string = qi_format_timezone_offset($offset, true);
        $timezones['UTC' . $offset_string . ' - ' . $timezone] = array('tz' => $timezone, 'offset' => $offset_string, 'current' => $current_time);
        if ($timezone === $default) {
            $default_offset = 'UTC' . $offset_string;
        }
    }
    unset($unsorted_timezones);
    uksort($timezones, 'qi_tz_select_compare');
    $tz_select = $opt_group = '';
    foreach ($timezones as $key => $timezone) {
        if ($opt_group != $timezone['offset']) {
            // Generate tz_select for backwards compatibility
            $tz_select .= $opt_group ? '</optgroup>' : '';
            $tz_select .= '<optgroup label="' . $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']) . '">';
            $opt_group = $timezone['offset'];
        }
        $label = $timezone['tz'];
        if (isset($user->lang['timezones'][$label])) {
            $label = $user->lang['timezones'][$label];
        }
        $title = $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $label);
        if ($truncate) {
            $label = truncate_string($label, 50, 255, false, '...');
        }
        // Also generate timezone_select for backwards compatibility
        $selected = $timezone['tz'] === $default ? ' selected="selected"' : '';
        $tz_select .= '<option title="' . $title . '" value="' . $timezone['tz'] . '"' . $selected . '>' . $label . '</option>';
    }
    $tz_select .= '</optgroup>';
    return $tz_select;
}
开发者ID:3D-I,项目名称:quickinstall,代码行数:53,代码来源:qi_functions.php

示例12: array

		    		<?php 
    echo $user->username;
    ?>
		    	</a>
		       <? else : ?>
		           <?php 
    echo $user->username;
    ?>
		       <? endif; ?>
		</td>
		<td>
			<?php 
    echo $user->group_name;
    ?>
		</td>
		<td>
			<?php 
    echo JApplicationHelper::getClientInfo($user->loggedin_client_id)->name;
    ?>
		</td>
		<td>
			<?php 
    echo @helper('com://admin/users.template.helper.date.humanize', array('date' => $user->loggedin_on - date_offset_get(new DateTime())));
    ?>
		</td>
	</tr>
<?php 
}
?>
</tbody>
</table>
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:31,代码来源:default.php

示例13: get_offset

 /**
  * Return timezone offset for the date being processed.
  */
 function get_offset($comp_date = NULL)
 {
     if (!empty($this->db_timezone) && !empty($this->local_timezone)) {
         if ($this->db_timezone != $this->local_timezone) {
             if (empty($comp_date)) {
                 $comp_date = new DrupalDateTime('now', $this->db_timezone);
             }
             $comp_date->setTimezone(timezone_open($this->local_timezone));
             return date_offset_get($comp_date);
         }
     }
     return 0;
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:16,代码来源:DateSqlHandler.php

示例14: MongoId

     $yc = $yakcatColl->findOne(array('_id' => new MongoId($id)));
     if (!empty($yc)) {
         $yakCatId[] = new MongoId($yc['_id']);
         $yakCatName[] = $yc['title'];
     }
 }
 /* EVENT DATE */
 $eventDate = array();
 $i = 0;
 foreach ($eventDateInput as $date) {
     $fixedDate = str_replace('.0Z', 'Z', $date[0]);
     $dateTimeFrom = DateTime::createFromFormat(DateTime::ISO8601, $fixedDate);
     $eventDate[$i]['dateTimeFrom'] = new MongoDate($dateTimeFrom->gettimestamp() - date_offset_get($dateTimeFrom));
     $fixedDate = str_replace('.0Z', 'Z', $date[1]);
     $dateTimeEnd = DateTime::createFromFormat(DateTime::ISO8601, $fixedDate);
     $eventDate[$i]['dateTimeEnd'] = new MongoDate(date_timestamp_get($dateTimeEnd) - date_offset_get($dateTimeEnd));
     $i++;
 }
 // clean duplicates cats and tags
 $freeTag = array_unique($freeTag);
 $yakCatName = array_unique($yakCatName);
 $yakCatId = array_unique($yakCatId);
 if (sizeof($freeTag) > 0) {
     $freeTag = array_diff($freeTag, $yakCatName);
 }
 $freeTag = (array) $freeTag;
 $freeTagNew = array_values($freeTag);
 $freeTag = $freeTagNew;
 $freeTagClean = array();
 echo '<br> DEBUG-----<br>';
 foreach ($freeTag as $t) {
开发者ID:rebe100x,项目名称:YAKREP,代码行数:31,代码来源:fetchPAPI.php

示例15: date_default_timezone_set

<?php

/* Prototype  : int date_offset_get  ( DateTime $object  )
 * Description: Returns the daylight saving time offset
 * Source code: ext/date/php_date.c
 * Alias to functions:  DateTime::getOffset
 */
//Set the default time zone
date_default_timezone_set('Europe/London');
echo "*** Testing date_offset_get() : basic functionality ***\n";
$winter = date_create('2008-12-25 14:25:41');
$summer = date_create('2008-07-02 14:25:41');
echo "Winter offset: " . date_offset_get($winter) / 3600 . " hours\n";
echo "Summer offset: " . date_offset_get($summer) / 3600 . " hours\n";
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:date_offset_get_basic1.php


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