PHP 把秒數轉為時分秒格式
PHP函數 1、gmdate 2、gmstrftime 封裝函數 ...
PHP函數 1、gmdate 2、gmstrftime 封裝函數 ...
formatSeconds(value) { let result = parseInt(value) let h = Math.floor(result / 3600) < ...
...
...
使用了es6的語法 ,如有出入,自行修改 ...
內容引入至網絡 ...
公司的業務是做直播的,因此主播完成直播之后,要知道每位主播的直播時長,根據直播時長來結算工資。在做的過程中,遇到了一個問題,就是如何將秒轉化為時分秒。想了一會,寫了如下的函數來解決問題: /** * 將秒數轉化為時分秒 */ public static ...
function secondToTimeStr(t) { if (!t) return; if (t < 60) return "00:" + ((i = t) < 10 ...