当前位置:网站首页>Convert seconds to * * hours * * minutes

Convert seconds to * * hours * * minutes

2022-06-30 19:48:00 imkaifan

Convert seconds to :* Hours ** minute

getHourMinute(val) {
    
      if (!val) {
    
        return `0 Hours 0 minute `;
      }
      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} Hours ${
      minutes} minute `;
    },

parseInt It's rounded :

parseInt(156457, 10)
 // 156457
parseInt(156457/60, 10)
// 2607
2607*60
// 156420
原网站

版权声明
本文为[imkaifan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/181/202206301910306050.html