相互减去两次?

时间:2015-04-07 16:42:37

标签: php

坚持这个问题上大学!

从另一个减去一次。时间格式为“HH:MM:SS:FF”,其中:

HH = hours – there are 24 hours in a day
MM = minutes – there are 60 minutes in a hour
SS = seconds – there are 60 seconds in a minute
FF = frames – there are 25 frames in a second

时间总是11个字符,每个元素总是2个字符 - 如果需要,用零填充。

 subtract $y from $x

'$x = “03:14:59:20”;
 $y = “01:16:01:02”;

我已经完成了这段代码

<?php
$now = new DateTime(); // current date/time
$now = new DateTime("03:14:59:20");
$ref = new DateTime("01:16:01:02");
$diff = $now->diff($ref);
printf('%d hours, %d minutes %d seconds %d frames', $diff->h, $diff->i, $diff->s, $diff->f);

但框架部分不起作用 提前致谢

0 个答案:

没有答案