Using a Date() instance, how might I round a time to the nearest five minutes?
For example: if it\'s 4:47 p.m. it\'ll set the time to 4:45 p.m.
Probably less efficient but here's another alternative:
debug('Current timestamp:', timestamp);
timestamp.setMilliseconds(0);
timestamp.setSeconds(0);
timestamp.setMinutes(Math.round(timestamp.getMinutes() / 5) * 5);
debug('Rounded timestamp:', timestamp);
Current timestamp: 2019-10-22T09:47:17.989Z Rounded timestamp: 2019-10-22T09:45:00.000Z