Relative Content

Tag Archive for javascriptalgorithmperformance

Computing index from timestamp

I would to compute index into an array from millisecond (epoch) timestamp. The array is 167 long, each index is hour in week (i.e. index 0 points to 0:00 on Monday, 24 to 0:00 on Tuesday, 28 to 4:00 Tuesday, …). I came to this solution, which works: