Found a script that works well if you take a period of time, for example, from 13:00 to 18:00, but if I want to take a period, say from 22:00 to 02:00, then the interval is not displayed correctly, how can I solve this problem? The essence of the script: takes a time start_time and end_time in timestamp format and splits into a period of 30 minutes
function times(start_time, end_time) { var data = [ [start_time, end_time] ], times = [], pair, i, n30, D = new Date(), H, M; for( pair=0; pair < data.length; pair++){ n30 = (data[pair][1] - data[pair][0]) / 1800 ; for( i=0; i<=n30; i++){ D.setTime( 1000 * (data[pair][0] + i*1800)); H = D.getUTCHours() ; M = D.getUTCMinutes(); times.push( ('<p>') +( H<10 ? '0'+H : H) +':' +( M<10 ? '0'+M : M) +('</p>') ); } } } I am conveying time from 2016-11-14 01:00:00 UTC at 946767600 (timestamp)
setTimeused there. It probably leaves part of the date unchanged and only changes time. Therefore, the transition to the new day gives not what we need. - teran