在PHP中转换从fullcalendar生成的日期时出现时区问题

时间:2014-12-03 05:20:16

标签: php jquery timezone fullcalendar strtotime

转换生成 jQuery fullcalendar 的日期时,时区在 Windows 中出现问题。

这是我发布的值,用于识别我在start中将(IST)变量作为字符串的错误,并且结尾是从 jQuery fullcalendar <获取响应的值/ strong>如你所见,时区在(India Standard Time)。请参考控制台图片

enter image description here

在php中使用strtotime()转换起始和结束变量后,我得到的是

enter image description here

以下是我用于转换的代码:

        $dat = array(
                    'eve_start' => date('Y-m-d', strtotime($_POST['start'])),
                    'eve_end' => date('Y-m-d', strtotime($_POST['end'])),
                    'eve_allDay' => 0
                );

由于eve_end

,您可能会注意到(India Standard Time)无法正常使用

1 个答案:

答案 0 :(得分:0)

试试这个,

$start = substr($_POST['start'], 0, strpos($_POST['start'], '('));
$end = substr($_POST['end'], 0, strpos($_POST['end'], '('));

$start_date = date('Y-m-d h:i:s', strtotime($start));
$end_date = date('Y-m-d h:i:s', strtotime($end));
$dat = array(
                'eve_start' => $start_date,
                'eve_end' => $end_date,
                'eve_allDay' => 0
            );