function amr_check_timezonesettings() { global $amr_globaltz; echo '<ul>'; if (function_exists('timezone_version_get')) { printf('<li>' . __('Your timezone db version is: %s', 'amr-ical-events-list') . '</li>', timezone_version_get()); } else { echo '<li>' . '<a href="http://en.wikipedia.org/wiki/Tz_database">' . __('Plugin cannot determine timezonedb version in php < 5.3.', 'amr-ical-events-list') . '</a>'; } echo '</li></li><li><a href="http://pecl.php.net/package/timezonedb">'; _e('Php timezonedb versions', 'amr-ical-events-list'); echo '</a> <a href="http://pecl.php.net/package/timezonedb">'; _e('Info on what changes are in which timezonedb version', 'amr-ical-events-list'); echo '</a></li>'; if (!isset($amr_globaltz)) { echo '<b>' . __('No global timezone - is there a problem here? ', 'amr-ical-events-list') . '</b>'; return; } $tz = get_option('timezone_string'); $settingslink = '<a href="' . get_option('siteurl') . '/wp-admin/options-general.php">' . __('Go to settings', 'amr-ical-events-list') . '</a>'; if ($tz == '') { $gmtoffset = get_option('gmt_offset'); if (!empty($gmtoffset)) { printf('<li style="color: red;"><b>' . __('You are using the "old" gmt_offset setting ', 'amr-ical-events-list') . '</b></li><li>', $gmtoffset); _e('Consider changing to the more accurate timezone setting', 'amr-ical-events-list'); echo '</li>'; } } $now = date_create('now', $amr_globaltz); echo '<li>' . __('The plugin thinks your timezone is: ', 'amr-ical-events-list') . timezone_name_get($amr_globaltz) . ' ' . $settingslink . '</li>' . '<li>' . __('The current UTC offset for that timezone is: ', 'amr-ical-events-list') . $now->getoffset() / (60 * 60) . '</li>'; if (function_exists('timezone_transitions_get')) { foreach (timezone_transitions_get($amr_globaltz) as $tr) { if ($tr['ts'] > time()) { break; } } } $utctz = new DateTimeZone('UTC'); if (isset($tr['ts'])) { $d = amr_create_date_time("@{$tr['ts']}", $utctz); //try {$d = new DateTime( "@{$tr['ts']}",$utctz );} //catch(Exception $e) { break;} date_timezone_set($d, $amr_globaltz); printf('<li>' . __('Switches to %s on %s. GMT offset: %d', 'amr-ical-events-list') . '</li>', $tr['isdst'] ? "DST" : "standard time", $d->format('d M Y @ H:i'), $tr['offset'] / (60 * 60)); } echo '<li>'; _e('Current time (unlocalised): ', 'amr-ical-events-list'); echo $now->format('r'); echo '</li></ul>'; }
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()); var_dump(timezone_open('sdf'));
<?php $versionTimezone = timezone_version_get(); echo $versionTimezone;
<?php $y = timezone_version_get();
?> xml version="1.0" encoding="UTF-8"?> <!-- $Revision: 335673 $ --> <!-- AUTO GENERATED, DO NOT TRANSLATE OR MODIFY BY HAND --> <appendix xml:id="timezones" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> &date.timezone.intro.title; &date.timezone.intro; <?php if (function_exists('timezone_version_get')) { ?> <note> <simpara> &date.timezone.dbversion; <?php echo timezone_version_get(); ?> . </simpara> </note> <?php } foreach ($groupedList as $group => $zones) { $m = count($zones) > 4 ? 5 : count($zones); ?> <sect1 xml:id="timezones.<?php echo strtolower($group); ?> "> <title><?php
/** * Get the version of the installed timezone database. * * @return string The timezone database version. */ public static function getTimezoneVersion() { return timezone_version_get(); }
<?php var_dump(timezone_version_get());