【发布时间】:2018-02-26 19:13:21
【问题描述】:
如何在php中将小时:分钟转换为秒?我想将此值转换为示例:6:30(6 小时 30 分钟)。
echo gmdate("H:i", 11685); // this is to convert seconds to hours:minutes
为此我需要反转..
【问题讨论】:
-
在寻求答案之前你有没有尝试过?
标签: php
如何在php中将小时:分钟转换为秒?我想将此值转换为示例:6:30(6 小时 30 分钟)。
echo gmdate("H:i", 11685); // this is to convert seconds to hours:minutes
为此我需要反转..
【问题讨论】:
标签: php
把它分开然后算一下,不难。
list($hours, $minutes) = explode(':', $time, 2);
$seconds = $minutes * 60 + $hours * 3600;
【讨论】: