如何基于输入过滤表[Symfony 3]

时间:2018-07-16 15:56:59

标签: php symfony symfony-forms

目前,我是使用PHP的实习生。我有这张表,可以得到所有项目的所有时间的总和:

它看起来像这样:

项目||小时

Project1 || 20:30
Project2 || 15:00

我需要按用户提交的时间间隔过滤小时数。

我考虑过放置2个输入来过滤,但是我不完全知道如何进行过滤。

我正在考虑创建通往页面的新路线,我的方向正确吗?

1 个答案:

答案 0 :(得分:0)

您的问题似乎有点太开放了 尝试创建一个接受时间(小时)值的输入,这样您就可以为每个时间求和。 以下示例可以提供帮助

    $minute = date("i", $h2);
    $second = date("s", $h2);
    $hour = date("H", $h2);

    $convert = strtotime("+$minute minutes", $h);
    $convert = strtotime("+$second seconds", $convert);
    $convert = strtotime("+$hour hours", $convert);
    $Time = date('H:i:s', $convert); // this will helpin the sum of the hrs(time)