E
E
ennet2015-09-17 12:41:27
JavaScript
ennet, 2015-09-17 12:41:27

How to display time interval between certain hours?

Hello! I have an array with time intervals in timestamp format. It is necessary to count these times and derive these values ​​from this interval, including the beginning and end in increments of 15 minutes. That is, here is the array

var timeArray = [
  [1442437200,1442470500],

  [1442473200,1442479500],

  [1442483100,1442489400],

  [1442493000,1442495700],

  [1442499300,1442505600],

  [1442508300,1442509200]
]


The output should be, if the interval is like this, then the text is like this [10:00,10:15,10:30,10:45,11:00,11:15, 11:30, 11:45, 12:45, 13:00, 13:15, 13:30, 13:45, 14:00, 14:15, 14:30]

Now I have already calculated the difference between the intervals in seconds, but how to withdraw with a step of 15 minutes - I can not figure it out. Tell me the best way to do it??

Here is what is already there https://jsfiddle.net/nfvotk38/1/

intervals are always given in multiples of 15, they cannot intersect, they always go sequentially

Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
matperez, 2015-09-17
@ennet

Divide each range into individual points in 15 minute increments. After that get your list, in milliseconds. Then iterate over the list and output each one via moment(timestamp, 'x').format('hh:mm');
https://jsfiddle.net/nfvotk38/3/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question