3

我网站上的以下输出是-1 hr,我只是想快速修复以相应地调整它,但我不确定语法是否正确......

<?php echo date('D, jS F @ g:ia', strtotime($row->datetime)); ?>
4

2 回答 2

4

Use the date_default_timezone_set function of PHP to set the your timezone as default it is taking the timezone of server.

Here is the list of timezones.

于 2013-07-02T12:29:50.487 回答
3

设置默认时区

$timezone = 'America/Los_Angeles';
$stored_time = '2011-01-30 18:23:49';

date_default_timezone_set($timezone);
$timestamp = strtotime($stored_time);
$local_time = $timestamp + date('Z');
$local_date = date('Y-m-d H:i:s', $local_time);

echo $local_date;
于 2013-07-02T12:29:10.600 回答