Human-friendly Dates and Times

Updated Apr 27, 2012   //   Reference

Date and datetime fields accept ‘human-friendly’ terms such as ‘yesterday’, ‘next Wednesday’ or ‘today + 12 months’. This article gives some examples.

The underlined time part shown in some examples is optional.

Note also that times should go at the end – this is important when you’re using relative days like ‘tomorrow’.

Specific times

  • tomorrow 3:00pm
  • yesterday 17:30
  • next Wednesday 7.00
  • this Fri noon
  • first weds in July 2020
  • second friday of december 2013 4:00pm
  • last day of July 2021

Calculated times

  • today* + 4 weeks 1700
  • this Fri + 12 months 8:00pm
  • 10 weekdays
  • 48 hours
  • today* 6 months 7 days ago

* When there is no time part specified (for example when entering ‘+ 4 weeks’), the word ‘today’ is important. Without it, the relative date is calculated from now i.e. the current time, and therefore has a time too. So if you just want to specify a date without a time (i.e. the time is 23:59), then you’ll need to add ‘today’ at the beginning.

For more examples and explanation about entering dates, please visit the PHP documentation page.

 

Support Categories