如何使用带有AngularJS的html显示10分钟间隔时间列表?

时间:2022-06-14 02:52:58

I want to show the time interval list with 10 minutes gap.

我想用10分钟的间隙来显示时间间隔列表。

For example : 6:00 6:10 6:20... and so on till 18:00

例如:6:00 6:10 6:20…一直到18点。

1 个解决方案

#1


1  

var now = new Date();
var hour = now.getHours();
var minute = now.getMinutes();

minute = minute - (minute % 10);

while (hour < 24) {
  minute += 10;
  
  if(minute === 60) {
    hour++;
    minute = 0;
  }
  
  console.log(hour + ':' + (minute || '00'))
}

#1


1  

var now = new Date();
var hour = now.getHours();
var minute = now.getMinutes();

minute = minute - (minute % 10);

while (hour < 24) {
  minute += 10;
  
  if(minute === 60) {
    hour++;
    minute = 0;
  }
  
  console.log(hour + ':' + (minute || '00'))
}