If I have a string which represents a date, like “2011/07/01” (which is 1st July 2011) , how would I output that in more readable forms, like:
1 July 2011
1 Jul 2011 (month as three letters)
And also, how could I make it intelligently show date ranges like “2011/07/01” to “2011/07/11” as
1 - 11 July 2001
(without repeating the ‘July’ and ‘2011’ in this case)
As NullUserException mentioned, you can use
strtotimeto convert the date strings to timestamps. You can output ‘intelligent’ ranges by using a different date format for the first date, determined by comparing the years, months and days: