js 时分秒转化为秒

 var time = '00:02:10';
          var hour = time.split(':')[0];
          var min = time.split(':')[1];
          var sec = time.split(':')[2];

          s = Number(hour*3600) + Number(min*60) + Number(sec);
          console.log(s);//130

 

posted @ 2019-04-26 16:52  Ananiah  阅读(4989)  评论(0编辑  收藏  举报