当前位置:网站首页>将秒数转换为**小时**分钟
将秒数转换为**小时**分钟
2022-06-30 19:11:00 【imkaifan】
将秒数转换为:*小时**分钟
getHourMinute(val) {
if (!val) {
return `0小时0分钟`;
}
const int = parseInt(val, 10);
const hours = parseInt(int / (60 * 60), 10);
const leaveTime = int % (60 * 60);
const minutes = parseInt(leaveTime / 60, 10);
return `${
hours}小时${
minutes}分钟`;
},
parseInt是取整的:
parseInt(156457, 10)
// 156457
parseInt(156457/60, 10)
// 2607
2607*60
// 156420
边栏推荐
猜你喜欢
随机推荐
Code shoe set - mt3111 · assignment
一文详解|Go 分布式链路追踪实现原理
【多线程】使用线程池、实现一个简单线程池
Warmup预热学习率「建议收藏」
Small notes - integer improvement (C language)
Character class of regular series
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
线上线下双结合,VR全景是家具线上转型好方法!
ROS advertisement data publishing tips - latch configuration
Task04:集合运算-表的加减法和join等--天池龙珠计划SQL训练营学习笔记
测试人进阶技能:单元测试报告应用指南
The project is configured with eslint. When the editor does not close the eslint function, the eslint does not take effect
线下门店为什么要做新零售?
Lombok
Which brokerage has the lowest commission? In addition, is it safe to open a mobile account?
漫画 | Oracle 被新时代抛弃了吗?
Cartoon | has Oracle been abandoned by the new era?
Task01: getting to know database and SQL (Note 1)
Tencent conference application market was officially launched, with more than 20 applications in the first batch
Gateway服务网关








