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; }
/** * 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); }
/** * 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; }
<?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基类
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; }
<?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===
/** * 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); }
<?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 = "******"; private $_password = "******"; 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
/** * 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); }
/** * {@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); break; case 'month': $rows = !empty($this->styleInfo->isMini()) ? $this->calendarBuildMiniMonth() : $this->calendarBuildMonth(); break; case 'day': $rows = $this->calendarBuildDay(); break; case 'week': $rows = $this->calendarBuildWeek(); // Merge the day names in as the first row. $rows = array_merge([CalendarHelper::weekHeader($this->view)], $rows); break; } // Send the sorted rows to the right theme for this type of calendar. $this->definition['theme'] = 'calendar_' . $this->options['calendar_type']; // Adjust the theme to match the currently selected default. // Only the month view needs the special 'mini' class, // which is used to retrieve a different, more compact, theme. if ($this->options['calendar_type'] == 'month' && !empty($this->styleInfo->isMini())) { $this->definition['theme'] = 'calendar_mini'; } elseif (in_array($this->options['calendar_type'], ['week', 'day']) && !empty($this->options['multiday_theme']) && !empty($this->options['theme_style'])) { $this->definition['theme'] .= '_overlap'; } $output = ['#theme' => $this->themeFunctions(), '#view' => $this->view, '#options' => $this->options, '#rows' => $rows]; unset($this->view->row_index); return $output; }
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; }
<?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===
/** * 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); }
?> </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); ?>
/** * 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; }
/** * Convert date string to a different timezone. * * @param string $date Date value to be converted. * @return string|false Returns the formated date on success or false if date_format() fails. */ function convert_date_timezone($date) { $newDate = date_create($date, timezone_open('GMT')); $tz_date = date_timezone_set($newDate, timezone_open($_SESSION["timezone"])); return date_format($tz_date, "h:ia d/m/Y"); }
public function run() { $tzOffset = null; if ($this->localTime) { // local mode, no offset needed $tzOffset = 0; $tz = Yii::app()->params->profile->timeZone; try { $dateTimeZone = new DateTimeZone($tz); } catch (Exception $e) { $dateTimeZone = null; } $localTime = new DateTime(); if (@date_timezone_set($localTime, $dateTimeZone)) { $tzOffset = $localTime->getOffset(); } } else { if (!isset($this->model)) { return; } $address = ''; if (!empty($this->model->city)) { $address .= $this->model->city . ', '; } if (!empty($this->model->state)) { $address .= $this->model->state; } if (!empty($this->model->country)) { $address .= ' ' . $this->model->country; } $tz = $this->model->timezone; try { $dateTimeZone = new DateTimeZone($tz); } catch (Exception $e) { $dateTimeZone = null; } $contactTime = new DateTime(); if (@date_timezone_set($contactTime, $dateTimeZone)) { $tzOffset = $contactTime->getOffset(); if (empty($this->model->timezone)) { // if we just looked this timezone up, $this->model->timezone = $tz; // save it $this->model->update(array('timezone')); } } elseif (!empty($this->model->timezone)) { // if the messed up timezone was previously saved, clear it $this->model->timezone = ''; $this->model->update(array('timezone')); } } if ($tzOffset !== null) { $offsetJs = ''; if ($this->localTime) { $offset = $tzOffset; $tzString = 'UTC'; $tzString .= $offset > 0 ? '+' : '-'; $offset = abs($offset); $offsetH = floor($offset / 3600); $offset -= $offsetH * 3600; $offsetM = floor($offset / 60); $tzString .= $offsetH; if ($offsetM > 0) { $tzString .= ':' . $offsetM; } Yii::app()->clientScript->registerScript('timezoneClock', 'x2.tzOffset = ' . $tzOffset * 1000 . '; x2.tzUtcOffset = " (' . addslashes($tzString) . ')";', CClientScript::POS_BEGIN); //echo Yii::t('app','Current time in').'<br><b>'.$address.'</b>'; } $clockType = Profile::getWidgetSetting('TimeZone', 'clockType'); Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/clockWidget.js'); Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/components/clockWidget.css'); $this->render('timeZone', array('widgetSettings' => $clockType)); } else { echo Yii::t('app', 'Timezone not available'); } }
<?php include "controller/proyectos.php"; $info_proyecto = proyectos::get_info($_GET['id']); date_timezone_set("America/Santiago"); $GMT = 4; ?> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=479830965428140"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <section class="background_page"> </section> <section class="inversion"> <div class="container"> <div class="row visible-lg visible-md"> <div class="col-md-11 col-lg-11 titulo seguidor"> <a href="index.php">Inicio > </a> <a href="proyectos.php">Proyectos de Inversion > </a> </div> <div class="col-md-12 col-lg-12 col-padding tabulado"> <div class="col-md-12 col-lg-12 tabs" style="padding:0 0 0 0;"> <div class="col-md-4 col-lg-4 active suptabs" data="proyecto"><numero><div>1</div></numero> <tabtitle> El Proyecto</tabtitle></div> <div class="col-md-4 col-lg-4 suptabs simulacion_tabs_data" data="simulacion"><numero><div>2</div></numero> <tabtitle> Simulación</tabtitle></div> <div class="col-md-4 col-lg-4 inversiontab" data="tuinversion"><numero><div>3</div></numero> <tabtitle> Tu Inversión</tabtitle></div> </div> <div class="col-md-12 col-lg-12 proyecto content-tabs" style="padding:0 0 0 0;"> <div class="col-md-12 col-lg-12 titulos"><h4><?php echo $info_proyecto['proyecto']['titulo'];
function amr_repeat_anevent(&$event, $astart, $aend, $limit) { global $amr_globaltz; /* for a single event, handle the repeats as much as is possible */ $repeats = array(); $exclusions = array(); $repeatstart = new Datetime(); //if cloning dont need tz $repeatstart = clone $event['DTSTART']; $event = amr_parseRepeats($event); if (!empty($event['RRULE'])) { if (isset($_GET['debugexc'])) { echo '<hr />After Parsing Repeats:<br />'; if (isset($event['RRULE'])) { echo ' RRULE:<br />'; var_dump($event['RRULE']); } echo '<br />* RDATE:<br />'; if (isset($event['RDATE'])) { var_dump($event['RDATE']); } echo '<br />* EXDATE:<br />'; if (isset($event['EXDATE'])) { var_dump($event['EXDATE']); } echo '<br />* EXRULE:<br />'; if (isset($event['EXRULE'])) { var_dump($event['EXRULE']); } } if (!isset($event['RRULE'][0])) { $event['RRULE'] = array($event['RRULE']); } /* depending where we got our rrule from, we may or may not have multiple */ if (isset($_GET['rdebug'])) { echo '<br><b>We have ' . count($event['RRULE']) . ' rrules</b>'; } foreach ($event['RRULE'] as $i => $rrule) { $reps = amr_process_RRULE($rrule, $repeatstart, $astart, $aend, $limit); if (is_array($reps) and count($reps) > 0) { $repeats = array_merge($repeats, $reps); } } if (isset($_GET['rdebug'])) { echo '<br>Got ' . count($repeats) . ' after RRULE'; } } if (!empty($event['RDATE'])) { foreach ($event['RDATE'] as $i => $rdate) { $reps = amr_process_RDATE($rdate, $repeatstart, $aend, $limit); if (is_array($reps) and count($reps) > 0) { $repeats = array_merge($repeats, $reps); } } } if (!empty($event['EXRULE'])) { //if (isset($_GET['debugexc'])) { echo '<br><h3>Have EXRULE </h3>';var_dump($event['EXRULE']);} foreach ($event['EXRULE'] as $i => $exrule) { $reps = amr_process_RRULE($exrule, $repeatstart, $astart, $aend, $limit); if (is_array($reps) and count($reps) > 0) { $exclusions = $reps; } } //if (isset($_GET['debugexc'])) { echo '<br><h3>Got '.count($exclusions). ' after EXRULE</h3>';} } if (!empty($event['EXDATE'])) { if (isset($_GET['debugexc'])) { echo '<br><h4>Have EXDATE to exclude </h4>'; foreach ($event['EXDATE'] as $exdate) { echo '<br />EXC:' . $exdate->format('c'); } } $exclusions = array(); foreach ($event['EXDATE'] as $i => $exdate) { $reps = amr_process_RDATE($exdate, $repeatstart, $aend, $limit); if (is_array($reps) and count($reps) > 0) { $exclusions = array_merge($exclusions, $reps); } } if (isset($_GET['debugexc'])) { echo '<br />Got ' . count($exclusions) . ' exclusions after checking EXDATE'; } } if (isset($_GET['rdebug'])) { echo '<br />Still have ' . count($repeats) . ' before exclusions<br />'; } /* Now remove the exclusions from the repeat instances */ if (is_array($exclusions) and count($exclusions) > 0) { foreach ($exclusions as $i => $excl) { date_timezone_set($excl, $amr_globaltz); foreach ($repeats as $j => $rep) { date_timezone_set($rep, $amr_globaltz); if (isset($_GET['debugexc'])) { echo '<br />Exc:' . $excl->format('c') . ' =? Rep:' . $rep->format('c'); } if ($excl->format('c') == $rep->format('c')) { // if ($excl === $rep) { // if (!($excl < $rep) and !($excl > $rep)) { if (isset($_GET['debugexc'])) { echo '<br> Exclusion matches repeat date, so exclude this date ' . $j . ' ' . $rep->format('c'); } unset($repeats[$j]); /* will create a gap in the index, but that's okay, not reliant on it */ } } } } if (isset($_GET['debugexc'])) { echo '<br>Now have ' . count($repeats) . ' after exclusions '; } return $repeats; }
function dateFormat($gmTime, $localTime, $timezone) { $date = date_create($localTime, timezone_open("GMT")); $date_format = date_format(date_timezone_set($date, timezone_open($timezone)), 'P'); $meeting_date = date("D, F jS Y, h:i A", strtotime($localTime)) . " (" . $timezone . ", GMT " . $date_format . ") (" . date("D, F jS Y, h:i A", strtotime($gmTime)) . " GMT)"; return $meeting_date; }
/** * Returns the unix timestamp of the date in UTC, * converted from the date timezone * * @return int */ public function getTimestamp() { if(empty($this->timezone)) { $this->timezone = 'UTC'; } $utcOffset = self::extractUtcOffset($this->timezone); if($utcOffset !== false) { return (int)($this->timestamp - $utcOffset * 3600); } // @fixme // The following code seems clunky - I thought the DateTime php class would allow to return timestamps // after applying the timezone offset. Instead, the underlying timestamp is not changed. // I decided to get the date without the timezone information, and create the timestamp from the truncated string. // Unit tests pass (@see Date.test.php) but I'm pretty sure this is not the right way to do it date_default_timezone_set($this->timezone); $dtzone = timezone_open('UTC'); $time = date('r', $this->timestamp); $dtime = date_create($time); date_timezone_set($dtime, $dtzone); $dateWithTimezone = date_format($dtime, 'r'); $dateWithoutTimezone = substr($dateWithTimezone, 0, -6); $timestamp = strtotime($dateWithoutTimezone); date_default_timezone_set('UTC'); return (int)$timestamp; }
<?php $birthday = $this->context->module->birthdateColumn; $gender = $this->context->module->genderColumn; $regdate = $this->context->module->regdateColumn; $timezone = isset($model->profile->timezone) ? new DateTimeZone($model->profile->timezone) : new DateTimeZone(); ?> <?php $basicInfo = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['label' => YBoard::t('yboard', 'Birthday'), 'value' => $birthday == null ? YBoard::t('yboard', 'None') : $model->profile->{$birthday}], ['label' => YBoard::t('yboard', 'Gender'), 'value' => $model->profile->{$gender} == 1 ? YBoard::t('yboard', 'Male') : YBoard::t('yboard', 'Female')], ['label' => YBoard::t('yboard', 'Joined'), 'value' => $regdate == null ? YBoard::t('yboard', 'None') : date_format(date_timezone_set(date_timestamp_set(date_create(), $model->profile->{$regdate}), $timezone), 'l, d-M-y H:i T')], 'location', 'signature', 'status']]); ?> <?php $foroStatistics = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['label' => YBoard::t('yboard', 'Last Visit'), 'value' => date_format(date_timezone_set(date_create($model->last_visit), $timezone), 'l, d-M-y H:i T')], 'appreciations', 'startedTopics', 'totalReplies', 'recentTopics:html']]); ?> <?php $webInfo = DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped detail-view'], 'attributes' => [['attribute' => 'blogger', 'visible' => trim($model->blogger) != ""], ['attribute' => 'contact_email', 'value' => $model->contact_email == 0 ? YBoard::t('yboard', 'Forbidden') : YBoard::t('yboard', 'Allowed')], ['attribute' => 'contact_pm', 'value' => $model->contact_pm == 0 ? YBoard::t('yboard', 'Forbidden') : YBoard::t('yboard', 'Allowed')], ['attribute' => 'facebook', 'visible' => trim($model->facebook) != ""], ['attribute' => 'skype', 'visible' => trim($model->skype) != ""], ['attribute' => 'google', 'visible' => trim($model->google) != ""], ['attribute' => 'linkedin', 'visible' => trim($model->linkedin) != ""], ['attribute' => 'metacafe', 'visible' => trim($model->metacafe) != ""], ['attribute' => 'github', 'visible' => trim($model->github) != ""], ['attribute' => 'orkut', 'visible' => trim($model->github) != ""], ['attribute' => 'orkut', 'visible' => trim($model->orkut) != ""], ['attribute' => 'tumblr', 'visible' => trim($model->tumblr) != ""], ['attribute' => 'twitter', 'visible' => trim($model->twitter) != ""], ['attribute' => 'website', 'visible' => trim($model->website) != ""], ['attribute' => 'wordpress', 'visible' => trim($model->wordpress) != ""], ['attribute' => 'yahoo', 'visible' => trim($model->yahoo) != ""], ['attribute' => 'youtube', 'visible' => trim($model->youtube) != ""]]]); ?> <div class="yboard-member-view container"> <div class="row"> <div class="col-md-2"> <div class="center"> <?php
<?php date_default_timezone_set("America/Los_Angeles"); var_dump(date_default_timezone_get()); var_dump(date_default_timezone_set("Asia/Shanghai")); var_dump(date_default_timezone_get()); var_dump(date_default_timezone_set("America/Los_Angeles")); var_dump(date_default_timezone_get()); $dt = date_create("2008-08-08 12:34:56"); var_dump(timezone_name_get(date_timezone_get($dt))); $dt = date_create("2008-08-08 12:34:56"); date_timezone_set($dt, timezone_open("Asia/Shanghai")); 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");
function amr_format_date($format, $datestamp) { /* want a integer timestamp or a date object */ global $amr_options, $amr_globaltz; //if (is_string($datestamp)) $datestamp = date_create($datestamp, $amr_globaltz); if (isset($amr_options['date_localise'])) { $method = $amr_options['date_localise']; } else { $method = 'wp'; } // v4.0.9 was none date_timezone_set($datestamp, $amr_globaltz); /* Converting here, but then some derivations wrong eg: unsetting of end date */ if (isset($_GET['tzdebug'])) { echo '<br />' . $datestamp->format('c'); } if ($method === 'wp') { return amr_wp_format_date($format, $datestamp, false); } else { if ($method === 'wpgmt') { return amr_wp_format_date($format, $datestamp, true); } else { if ($method === 'amr') { return amr_date_i18n($format, $datestamp); } else { if (stristr($format, '%')) { return strftime($format, $datestamp->format('U')); } else { return $datestamp->format($format); } } } } }
private function _GetDateFromUTC($format, $date, $tz_str) { $timezone = $this->_GetTimezoneFromString($tz_str); $dt = date_create('@' . $date); date_timezone_set($dt, timezone_open($timezone)); return date_format($dt, $format); }
include_once ROOT_PATH . 'includes/admin_config.php'; include_once ROOT_PATH . 'includes/db.class.php'; include_once ROOT_PATH . 'includes/class_smarty.php'; include_once ROOT_PATH . 'includes/admin_function.php'; include_once ROOT_PATH . 'includes/upload.class.php'; //转义由 addslashes的 GET POST COOKIE if (@get_magic_quotes_gpc()) { function str($str) { if (is_array($str)) { foreach ($str as $k => $v) { $str[$k] = str($v); } } else { $str = stripcslashes($str); } return $str; } $_GET = str($_GET); $_POST = str($_POST); $_COOKIE = str($_COOKIE); } $db = new db($db_host, $db_user, $db_password, $db_name, $db_port); $db->set_charset('utf8'); @date_timezone_set('PRC'); $format = "SELECT * FROM `{$GLOBALS['db_prefix']}styem`"; $query = $GLOBALS['db']->query($format); $config_array = array(); while ($row = $query->fetch_assoc()) { $config_array[$row['styem_key']] = $row['styem_values']; }
function amr_say_when($timestamp, $report = '') { global $tzobj; // if (WP_DEBUG) echo '<br />Timestamp = '.$timestamp; //$d = date_create(strftime('%C-%m-%d %H:%I:%S',$timestamp)); //do not use %c - may be locale issues $d = new datetime('@' . $timestamp); //do not use %c - may be locale issues, wdindows no likely %C if (is_object($d)) { if (!is_object($tzobj)) { amr_getset_timezone(); } date_timezone_set($d, $tzobj); $timetext = $d->format(get_option('date_format') . ' ' . get_option('time_format')); $text = sprintf(__('Cache already scheduled for %s, in %s time', 'amr-users'), $timetext . ' ' . timezone_name_get($tzobj), human_time_diff(time(), $timestamp)); } else { $text = 'Unknown error in formatting timestamp got next cache: ' . $timestamp . ' ' . print_r($d, true); } return $text; }
function CreateEwsCalendarItem($username, $password, $array_item) { if (count($array_item) < 1) { $a_rdv['FAILT'] = array("REQUEST_RESULT" => false, 'EWS_ACTION' => 'CREATECALENDAR', 'STATUS_REQUEST' => 'EMPTY_CALENDAR_ITEM'); return $a_rdv; } $rootpath = APPPATH . '\\libraries'; include $rootpath . '\\config_ews\\config_ews.php'; $ews = new ExchangeWebServices($hostmail, $username, $password); $request = new EWSType_CreateItemType(); $request->Items = new EWSType_NonEmptyArrayOfAllItemsType(); $request->Items->CalendarItem = new EWSType_CalendarItemType(); if (isset($array_item['SUJET']) == true) { if (trim($array_item['SUJET']) != '' && $array_item['SUJET'] != null) { $request->Items->CalendarItem->Subject = trim($array_item['SUJET']); } else { $request->Items->CalendarItem->Subject = ''; } } else { $request->Items->CalendarItem->Subject = ''; } if (isset($array_item['OU']) == true) { if (trim($array_item['OU']) != '' && $array_item['OU'] != null) { $request->Items->CalendarItem->Location = trim($array_item['OU']); } else { $request->Items->CalendarItem->Location = ''; } } else { $request->Items->CalendarItem->Location = ''; } $DateTimeZone = timezone_open('UTC'); $DateTZ = timezone_open('Europe/Brussels'); //$dateSrc = $cal_rdv->Start; //$local_start = date_create($dateSrc); //date_timezone_set($local_start, $DateTimeZone); //date_timezone_set($local_start, $DateTZ); $temp_start_date = $array_item['START_DATE']; $a_date = explode('-', $temp_start_date); $temp_start_date = $a_date[2] . '-' . $a_date[1] . '-' . $a_date[0]; //$request->Items->CalendarItem->Start = $temp_start_date.'T'.$array_item['START_HEURE'].'Z'; $dateSrc = $temp_start_date . ' ' . $array_item['START_HEURE']; $local_start = date_create($dateSrc); //date_timezone_set($local_start, $DateTZ); //echo $local_start->format('Y-m-d\TH:i:s\Z').'<br />'; date_timezone_set($local_start, $DateTimeZone); //echo $local_start->format('Y-m-d\TH:i:s\Z').'<br />'; //$request->Items->CalendarItem->Start = $temp_start_date.'T'.$array_item['START_HEURE'].'Z'; $request->Items->CalendarItem->Start = $local_start->format('Y-m-d\\TH:i:s\\Z'); $temp_start_date = $array_item['END_DATE']; $a_date = explode('-', $temp_start_date); $temp_start_date = $a_date[2] . '-' . $a_date[1] . '-' . $a_date[0]; //$request->Items->CalendarItem->End = $temp_start_date.'T'.$array_item['END_HEURE'].'Z'; $dateSrc = $temp_start_date . ' ' . $array_item['END_HEURE']; $local_start = date_create($dateSrc); date_timezone_set($local_start, $DateTimeZone); //date_timezone_set($local_start, $DateTZ); $request->Items->CalendarItem->End = $local_start->format('Y-m-d\\TH:i:s\\Z'); if (isset($array_item['ALLDAY']) == false) { $request->Items->CalendarItem->IsAllDayEvent = false; } else { if ($array_item['ALLDAY'] != true) { $request->Items->CalendarItem->IsAllDayEvent = false; } else { $request->Items->CalendarItem->IsAllDayEvent = true; } // false - true } if (isset($array_item['BUSYSTATUS']) == false) { $request->Items->CalendarItem->LegacyFreeBusyStatus = 'Free'; } else { if ($array_item['BUSYSTATUS'] != 'Free' && $array_item['BUSYSTATUS'] != 'Busy') { $request->Items->CalendarItem->LegacyFreeBusyStatus = 'Free'; } else { $request->Items->CalendarItem->LegacyFreeBusyStatus = $array_item['BUSYSTATUS']; } // Busy - Free } if (isset($array_item['CATEGORY']) == true) { $request->Items->CalendarItem->Categories = new EWSType_ArrayOfStringsType(); $request->Items->CalendarItem->Categories->String = $array_item['CATEGORY']; //$request->Items->CalendarItem->Categories->String = array('Catégorie Rouge','Urgent'); } if (isset($array_item['BODY']) == true) { if (trim($array_item['BODY']) != '' && $array_item['BODY'] != null) { if (isset($array_item['BODYTYPE']) != true) { $request->Items->CalendarItem->Body->BodyType = 'Text'; } else { if ($array_item['BODYTYPE'] != 'HTML') { $request->Items->CalendarItem->Body->BodyType = 'Text'; } else { $request->Items->CalendarItem->Body->BodyType = 'HTML'; } // Text - HTML } $request->Items->CalendarItem->Body->_ = trim($array_item['BODY']); } else { $request->Items->CalendarItem->Body->BodyType = 'Text'; $request->Items->CalendarItem->Body->_ = ''; } } else { $request->Items->CalendarItem->Body->BodyType = 'Text'; $request->Items->CalendarItem->Body->_ = ''; } if (isset($array_item['REQ_INVITE']) == true) { if (count($array_item['REQ_INVITE']) > 0) { // Setup the RequiredAttendees array $request->Items->CalendarItem->RequiredAttendees = array(); $array_attendees = $array_item['REQ_INVITE']; foreach ($array_attendees as $i => $array_temp) { $request->Items->CalendarItem->RequiredAttendees[$i] = new EWSType_AttendeeType(); $request->Items->CalendarItem->RequiredAttendees[$i]->Mailbox = new EWSType_EmailAddressType(); $request->Items->CalendarItem->RequiredAttendees[$i]->Mailbox->Name = $array_temp['NAME']; $request->Items->CalendarItem->RequiredAttendees[$i]->Mailbox->EmailAddress = $array_temp['EMAIL']; $request->Items->CalendarItem->RequiredAttendees[$i]->Mailbox->RoutingType = "SMTP"; } } } if (isset($array_item['OPT_INVITE']) == true) { if (count($array_item['OPT_INVITE']) > 0) { // Setup the OptionalAttendees array $request->Items->CalendarItem->OptionalAttendees = array(); $array_attendees = $array_item['OPT_INVITE']; foreach ($array_attendees as $i => $array_temp) { $request->Items->CalendarItem->OptionalAttendees[$i] = new EWSType_AttendeeType(); $request->Items->CalendarItem->OptionalAttendees[$i]->Mailbox = new EWSType_EmailAddressType(); $request->Items->CalendarItem->OptionalAttendees[$i]->Mailbox->Name = $array_temp['NAME']; $request->Items->CalendarItem->OptionalAttendees[$i]->Mailbox->EmailAddress = $array_temp['EMAIL']; $request->Items->CalendarItem->OptionalAttendees[$i]->Mailbox->RoutingType = "SMTP"; } } } //SEND_TO_NONE //SEND_ONLY_TO_ALL //SEND_TO_ALL_AND_SAVE_COPY if (isset($array_item['SENDINVIT']) == true) { switch (trim($array_item['SENDINVIT'])) { case 'SEND_TO_NONE': $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE; break; case 'SEND_ONLY_TO_ALL': $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL; break; case 'SEND_TO_ALL_AND_SAVE_COPY': $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_ALL_AND_SAVE_COPY; break; default: $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE; break; } } else { $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE; } $a_rdv = array(); try { $response = $ews->CreateItem($request); } catch (EWS_Exception $e) { if ($e->getCode() == 401) { $a_rdv['FAILT'] = array("REQUEST_RESULT" => false, 'EWS_ACTION' => 'CREATECALENDAR', 'STATUS_REQUEST' => 'CONNEXION_ERROR'); } else { $a_rdv['FAILT'] = array("REQUEST_RESULT" => false, 'EWS_ACTION' => 'CREATECALENDAR', 'STATUS_REQUEST' => $e->getMessage()); } return $a_rdv; } $ResponseClass = $response->ResponseMessages->CreateItemResponseMessage->ResponseClass; $ResponseCode = $response->ResponseMessages->CreateItemResponseMessage->ResponseCode; if ($ResponseClass == 'Error') { $a_rdv['FAILT'] = array("REQUEST_RESULT" => false, 'EWS_ACTION' => 'CREATECALENDAR', 'STATUS_REQUEST' => 'ERROR'); return $a_rdv; } //echo '<pre>'.print_r($request, true).'</pre>'; $array_ech = $response->ResponseMessages->CreateItemResponseMessage->Items->CalendarItem; $key_array = $array_ech->ItemId->Id . '||' . $array_ech->ItemId->ChangeKey; $a_rdv[$key_array] = array("REQUEST_RESULT" => true, 'EWS_ACTION' => 'CREATECALENDAR', "ID" => $array_ech->ItemId->Id, "CHANGEKEY" => $array_ech->ItemId->ChangeKey); return $a_rdv; }
class classWithToString { public function __toString() { return "Class A object"; } } class classWithoutToString { } // heredoc string $heredoc = <<<EOT hello world EOT; // add arrays $index_array = array(1, 2, 3); $assoc_array = array('one' => 1, 'two' => 2); // resource $file_handle = fopen(__FILE__, 'r'); //array of values to iterate over $inputs = array('int 0' => 0, 'int 1' => 1, 'int 12345' => 12345, 'int -12345' => -12345, 'float 10.5' => 10.5, 'float -10.5' => -10.5, 'float .5' => 0.5, 'empty array' => array(), 'int indexed array' => $index_array, 'associative array' => $assoc_array, 'nested arrays' => array('foo', $index_array, $assoc_array), 'uppercase NULL' => NULL, 'lowercase null' => null, 'lowercase true' => true, 'lowercase false' => false, 'uppercase TRUE' => TRUE, 'uppercase FALSE' => FALSE, 'empty string DQ' => "", 'empty string SQ' => '', 'string DQ' => "string", 'string SQ' => 'string', 'mixed case string' => "sTrInG", 'heredoc' => $heredoc, 'instance of classWithToString' => new classWithToString(), 'instance of classWithoutToString' => new classWithoutToString(), 'undefined var' => @$undefined_var, 'unset var' => @$unset_var, 'resource' => $file_handle); $object = date_create("2009-01-30 17:57:32"); foreach ($inputs as $variation => $timezone) { echo "\n-- {$variation} --\n"; var_dump(date_timezone_set($object, $timezone)); } // closing the resource fclose($file_handle); ?> ===DONE===
/** * Returns a new instance of this datetime with the changed timezone. * * @param DateTimeZone|string $timezone * @return DateTime */ public function setTimezone($timezone) { $newDate = clone $this; return date_timezone_set($newDate, $timezone); }