dongmangwei3822 2013-06-23 08:44
浏览 49
已采纳

使用PHP减去两个MySQL时间变量

I show my problem:

I have two variables that contain the TIME variable from an MySQL database:

$row[0] //it contains for instance 16:30:00
$row[1] //it contains for instance 18:00:00

How do I find the term that is derived from their subtraction?

As they are already time variables I tried to do a subtraction directly with these values ​​but I get integer values ​​rounded down.

I tried existing questions but none foresaw a time in the format HH: MM: SS.

Thank you.

  • 写回答

3条回答 默认 最新

  • douzhaxian1267 2013-06-23 08:49
    关注

    try to use

    $query = select TIMEDIFF(field_name, '$input_date') from tbl_name where condition
    

    at mysql

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部