mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
TZ list
This commit is contained in:
parent
d4de297092
commit
1ee544fed6
1 changed files with 48 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
// Check system settiongs
|
||||
if ((!isset($_SESSION['VERSION'])) && (!defined('NO_AUTH_REQUIRED'))) {
|
||||
session_destroy();
|
||||
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
|
||||
header("Location: /login/");
|
||||
exit;
|
||||
}
|
||||
|
@ -241,4 +242,51 @@ function display_error_block() {
|
|||
unset($_SESSION['error_msg']);
|
||||
}
|
||||
}
|
||||
|
||||
function list_timezones() {
|
||||
$tz = new DateTimeZone('HAST');
|
||||
$timezone_offsets['HAST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('HADT');
|
||||
$timezone_offsets['HADT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('AKST');
|
||||
$timezone_offsets['AKST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('AKDT');
|
||||
$timezone_offsets['AKDT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('PST');
|
||||
$timezone_offsets['PST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('PDT');
|
||||
$timezone_offsets['PDT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('MST');
|
||||
$timezone_offsets['MST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('MDT');
|
||||
$timezone_offsets['MDT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('CST');
|
||||
$timezone_offsets['CST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('CDT');
|
||||
$timezone_offsets['CDT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('EST');
|
||||
$timezone_offsets['EST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('EDT');
|
||||
$timezone_offsets['EDT'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('AST');
|
||||
$timezone_offsets['AST'] = $tz->getOffset(new DateTime);
|
||||
$tz = new DateTimeZone('ADT');
|
||||
$timezone_offsets['ADT'] = $tz->getOffset(new DateTime);
|
||||
|
||||
foreach(DateTimeZone::listIdentifiers() as $timezone){
|
||||
$tz = new DateTimeZone($timezone);
|
||||
$timezone_offsets[$timezone] = $tz->getOffset(new DateTime);
|
||||
}
|
||||
|
||||
foreach($timezone_offsets as $timezone => $offset){
|
||||
$offset_prefix = $offset < 0 ? '-' : '+';
|
||||
$offset_formatted = gmdate( 'H:i', abs($offset) );
|
||||
$pretty_offset = "UTC${offset_prefix}${offset_formatted}";
|
||||
$t = new DateTimeZone($timezone);
|
||||
$c = new DateTime(null, $t);
|
||||
$current_time = $c->format('H:i:s');
|
||||
$timezone_list[$timezone] = "$timezone [ $current_time ] ${pretty_offset}";
|
||||
}
|
||||
return $timezone_list;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue