Php 如何安排去瑞典的时间?
我有一个电台网站,有一个叫做“upNext”的模块,当下一位DJ到来时,该模块将向我的访问者展示 但在网站上时间不对 从10:00开始放映,但我在瑞典的时间很快是13:00。我该如何解决这个问题 我有som代码:Php 如何安排去瑞典的时间?,php,timezone,Php,Timezone,我有一个电台网站,有一个叫做“upNext”的模块,当下一位DJ到来时,该模块将向我的访问者展示 但在网站上时间不对 从10:00开始放映,但我在瑞典的时间很快是13:00。我该如何解决这个问题 我有som代码: <?php // Include the required glob.php file require_once( "../_inc/glob.php" ); // Grab today's date using PHP date() $toda
<?php
// Include the required glob.php file
require_once( "../_inc/glob.php" );
// Grab today's date using PHP date()
$today_date = date( 'N' );
// Grab the current hour
$now_hour = date( 'H' );
// Now we have the current hour, we add one to get the next hour
$next_hour = $now_hour + 1;
if ( $next_hour == 24 ) {
// It's midnight on the next day
$next_date = $today_date + 1;
$next_hour = "0";
}
else {
// It's the same day
$next_date = $today_date;
}
有人能帮我吗?设置时区
date_default_timezone_set("Europe/Stockholm");
有关时区的更多信息,请查看此链接:
date_default_timezone_set("Europe/Stockholm");