<div class="time">
<ul>
<li>
<div class="img">
<?php
date_default_timezone_set('PRC'); //设定时区,PRC就是天朝
$hour = date('H');
if($hour <= 18 && $hour >= 6){
echo '<img src="/wp-content/themes/uniontradecn/images/sun.png" alt="sun" class="img-responsive">';
}else{
echo '<img class="moon img-responsive" src="/wp-content/themes/uniontradecn/images/moon.png" alt="moon" >';
}
?>
</div>
<?php
echo '<h2 id="bjdtime"></h2> ';
?>
<p>Beijing time</p>
</li>
<li>
<div class="img">
<?php
function_exists(date_default_timezone_set);
date_default_timezone_set("Etc/GMT");
date_default_timezone_set("Etc/GMT-2");
$hour = date('H');
if($hour <= 18 && $hour >= 6){
echo '<img src="/wp-content/themes/uniontradecn/images/sun.png" alt="sun" class="img-responsive">';
}else{
echo '<img class="moon img-responsive" src="/wp-content/themes/uniontradecn/images/moon.png" alt="moon" >';
}
?>
</div>
<?php
echo '<h2 id="nytime"></h2> ';
?>
<p>Ankara time</p>
</li>
</ul>