Hi All,
This problem has gone beyond the realms of my programming knowledge.
I have an array that I have ordered numerically:
var data = new Array(200812151000, 200812151315, 200812161000, 200812161315, 200812161930, 200812171000, 200812171315, 200812181000, 200812181315, 200812191000, 200812191315);
For your info each figure corresponds to a date YYYYMMDDHHMM
What I would like to do is reorder the array if the red figures are consecutive (15 => 16, 16 => 17) AND the green figures remain the same. So to use the date reference, gather together consecutive day events occurring at the same scheduled time.
Now I know it can probably be done as an Array sort. If you look for a comparative difference of exactly 10000 then that would probably hit the target, I just cannot program it with my knowledge.
By the way the correct ordered output for the above array would be as follows (as you can see, the groups themselves would appear based on the numerical value of the first number in the sequence):
200812151000
200812161000
200812171000
200812181000
200812191000
200812151315
200812161315
200812171315
200812181315
200812191315
200812161930
This problem has gone beyond the realms of my programming knowledge.
I have an array that I have ordered numerically:
var data = new Array(200812151000, 200812151315, 200812161000, 200812161315, 200812161930, 200812171000, 200812171315, 200812181000, 200812181315, 200812191000, 200812191315);
For your info each figure corresponds to a date YYYYMMDDHHMM
What I would like to do is reorder the array if the red figures are consecutive (15 => 16, 16 => 17) AND the green figures remain the same. So to use the date reference, gather together consecutive day events occurring at the same scheduled time.
Now I know it can probably be done as an Array sort. If you look for a comparative difference of exactly 10000 then that would probably hit the target, I just cannot program it with my knowledge.
By the way the correct ordered output for the above array would be as follows (as you can see, the groups themselves would appear based on the numerical value of the first number in the sequence):
200812151000
200812161000
200812171000
200812181000
200812191000
200812151315
200812161315
200812171315
200812181315
200812191315
200812161930