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 201
I would use strtotime
AND strftime
. Is a much simpler way of doing it.
By example, if a have a date string like "Oct 20 18:29:50 2001 GMT" and I want to get it in format day/month/year I could do:
$mystring = "Oct 20 18:29:50 2001 GMT";
printf("Original string: %s\n", $mystring);
$newstring = strftime("%d/%m/%Y", strtotime($mystring));
printf("Data in format day/month/year is: %s\n", $newstring);