Here is a function I have recently had to use, you pass a time / date string in strtotime format and the function will return a string with a date relative to today.

Examples of what the function can return;

  • Today
  • Yesterday
  • Tomorrow
  • In 2 days
  • In 6 days
  • 5 days ago
  • Thursday 17 January
  • Tuesday 4 January 2005

Example of usage;

The Function;