doubo4824 2013-07-16 14:28
浏览 9
已采纳

2次之间的差异在小时数字段中显示12

$start_time = '10:36:23';  
$end_time = '10:36:26';   

$v =  strtotime($end_time) - strtotime($start_time);  


echo date("h:i:s", $v);

Result should be 00:00:03. But is showing 12:00:03.

How can i resolve this?

  • 写回答

4条回答 默认 最新

  • dptsivmg82908 2013-07-16 14:36
    关注

    Lowercase h gives you the hour in 12-hour format. So an hour of zero is after midnight which is 12 AM. If you use uppercase H it will display as you want.

    echo date("H:i:s", $v);
    

    Your difference is not actually a time, it is a time span.

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

报告相同问题?

悬赏问题

  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图