Created
August 21, 2016 20:44
-
-
Save grok/e57f9668928f534cfedb58d87003f8bd to your computer and use it in GitHub Desktop.
This is the current hour of the year... but rolled back to the beginning of the day.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timestmp = new Date().setFullYear(new Date().getFullYear(), 0, 1); | |
var yearFirstDay = Math.floor(timestmp / 86400000); | |
var today = Math.ceil((new Date().getTime()) / 86400000); | |
var dayOfYear = today - yearFirstDay; | |
var currentHourOfYear = dayOfYear * 24 - 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment