0
我一直在努力几个小时的错误,我敢肯定它很愚蠢,但我找不到解决它。PHP - 日期时间 - >添加不工作。说DateInterval格式是错的
我的想法是创建一个DateTime(00:00:00),以便在每个$ i的4:30小时循环中添加它。
$saldo_funcionario = new DateTime('00:00:00');
for ($i=0; $i<$value; $i++) {
$tempo_dia_funcionario = new DateInterval('PT4H30I');
$saldo_funcionario->add($tempo_dia_funcionario);
}
的错误信息是:
Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct(): Unknown or bad format (PT4H30I)'
DateInterval->__construct('PT4H30I') #1 {main} on line 75
我在哪里丢失的?
新的日期时间输入()必须至少约会...你只供应一时间 – RichardBernards 2014-11-14 12:48:01
应间隔4小时30分钟? – AlexL 2014-11-14 12:48:04
没有'I'修饰符,只有'M'几分钟和几个月。 – 2014-11-14 12:48:26