Hello everyone! I need help with creating a JavaScript array that contains all 24 hours of the day, but I want the array to begin from whatever the current hour is right now.
Here’s what I’m looking for:
Let’s say it’s currently 2:00 PM. I want my array to look like this:
['1400', '1500', '1600', '1700', '1800', '1900', '2000', '2100', '2200', '2300', '0000', '0100', '0200', '0300', '0400', '0500', '0600', '0700', '0800', '0900', '1000', '1100', '1200', '1300']
Rather than getting the standard order:
['0000', '0100', '0200', '0300', '0400', '0500', '0600', '0700', '0800', '0900', '1000', '1100', '1200', '1300', '1400', '1500', '1600', '1700', '1800', '1900', '2000', '2100', '2200', '2300']
Basically, I want the current hour to be the first element, and then continue through the remaining hours in chronological order. Any ideas on how to achieve this?