I have the following dates in an array (dates will not always be these dates)
[0] 2012-10-18
[1] 2012-10-19
[2] 2012-10-20
[3] 2012-10-23
[4] 2012-10-24
[5] 2012-10-29
[6] 2012-10-30
I want to group consecutive dates together so the output is:
2012-10-18 to 2012-10-20
2012-10-23 to 2012-10-24
2012-10-29 to 2012-10-30
How would I do this in PHP?
Thanks!
This piece of code groups consecutive dates together and understands daylight saving.
Array of numbers
Code:
Outputs: