Possible Duplicate:
Human-readable, current time sensitive date and time formatting in PHP
Human Readable Date Using PHP
I'm looking for a way to generate human readable date references, in conversational style, such as the following:
diff( '2012-05-15', '2012-05-21' ) == "last Tuesday"
diff( '2012-05-15', '2012-05-16' ) == "yesterday"
diff( '2012-05-15', '2012-05-17' ) == "on Tuesday"
diff( '2012-04-11', '2012-05-21' ) == "on the 11th of April"
I looked into strtotime()
, which seems to do the inverse of what I want. The solution doesn't need to work with future dates, just past dates. I saw another question asking the same thing for future dates in JavaScript, but it didn't really solve my problem.
Any ideas?