我有一个拖放式旋转应用程序,除了10月30日星期日(当我们的时钟返回一小时)时工作正常。 用户将时间和持续时间框拖到日期上,系统将进行计算。不幸的是,本月30日系统从开始时间开始扣除1小时。 我尝试在方法的顶部添加date_default_timezone_set('Europe / London')。还添加$ start_date-> setTimezone(new DateTimeZone('Europe / London'));在各个地方没有任何成功。
/* Pull in date from rota in format 20-10-2016 */
$date = Input::get('date');
/* Pull in the details of the shift */
$actions = Rotaaction::find(Input::get('action_id'));
$duration = $actions->duration;
/* Set the start date/time of the shift */
$start_date = DateTime::createFromFormat('Y-m-d',$date);
$start_date->setTime(0,0,0);
$start_date->add(new DateInterval("P0000-00-00T$actions->start_time"));
/* Set the finish date/time of the shift */
$end_date = Clone $start_date;
$end_date->modify("+{$duration} minutes");
到目前为止,我添加了一个'if',在该日期增加了一个小时,但必须有一个'正确'的方式。 感谢您的帮助