flamy
12-10-2008, 11:05 AM
I have an array of dates:
15-12-2008,16-12-2008,17-12-2008,18-12-2008,19-12-2008,22-12-2008,23-12-2008,24-12-2008,25-12-2008,26-12-2008,
I'd like to display them like:
15-12-2008 to 19-12-2008
22-12-2008 to 26-12-2008
Surely somebody has already written a function to do this?
I presume I'd need to put all 2008 dates into a separate array, then the months, then do something like loop through the days and if the next array item is the value +1 then loop until it is not +1 to give me the range. But then, what if the range goes between months e.g. 27-02-2008 to 13-03-2008.
Any help or an already written function to do this would be gratefully appreciated. :)
15-12-2008,16-12-2008,17-12-2008,18-12-2008,19-12-2008,22-12-2008,23-12-2008,24-12-2008,25-12-2008,26-12-2008,
I'd like to display them like:
15-12-2008 to 19-12-2008
22-12-2008 to 26-12-2008
Surely somebody has already written a function to do this?
I presume I'd need to put all 2008 dates into a separate array, then the months, then do something like loop through the days and if the next array item is the value +1 then loop until it is not +1 to give me the range. But then, what if the range goes between months e.g. 27-02-2008 to 13-03-2008.
Any help or an already written function to do this would be gratefully appreciated. :)