经过两次计算器的时间

时间:2017-03-10 06:49:25

标签: php

<input type = "text"  name = "time1" value = "<?php echo   $row['Hours'];  ?>">
<input type = "text"  name = "time2"> 
<input type = "submit"name = "Compute" value = "Compute" >

$calc="";
if(isset($_POST["Compute"]))
{
$time1=$_POST['time1'];
$time2=$_POST['time2'];


$calc = ($time1=$_POST['time1']-$time2=$_POST['time2']);

我想计算两次之间经过的小时数。例如,我在文本框1上午9:30输入,然后在textbox2中输入,我在下午5:00输入

1 个答案:

答案 0 :(得分:1)

使用strtotime功能

( strtotime('12:45:00') - strtotime('11:00:00') ) / 60

In Details