dispalys the timezone in dropdown ....... bootstrap datetimepicker我有一个下拉菜单,其中显示了所有时区。我有一个引导datetimepicker。第一个下拉菜单中的时区onselect
,datetimepicker
中的日期和时间需要根据所选时区进行更改。
<div class="form-group">
<div class='input-group date' id='datetimepicker5'>
<input type='text' class="form-control" placeholder="start-date" required />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker5').datetimepicker({
defaultDate: moment(),
widgetPositioning:{
horizontal: 'auto',
vertical: 'top'
}
});
});
</script>
</div>
<div class="form-group">
<select class="form-control" id="shiftroster_timezone" required>
<option value=" "> select timezone</option>
{% for table in zoned_array %}
{% set selected = '' %}
{% if (table.zone ~ ' ' ~ table.diff_from_GMT) == services_names %}
{% set selected = 'selected' %}
{% endif %}
<option value="{{table.diff_from_GMT}}" {{ selected }}> {{table.zone}} {{table.diff_from_GMT}}</option>
var_dump{{table.diff_from_GMT}};
{% endfor %}
</select>
</div>
$zones_array = array();
$timestamp = time();
foreach(timezone_identifiers_list() as $key => $zone) {
date_default_timezone_set($zone);
$zones_array[$key]['zone'] = $zone;
$zones_array[$key]['diff_from_GMT'] = 'UTC/GMT ' . date('P', $timestamp);
}