Skip to content

Instantly share code, notes, and snippets.

View wottpal's full-sized avatar

Dennis Zoma wottpal

View GitHub Profile
@wottpal
wottpal / relative-time.php
Last active October 21, 2017 16:38 — forked from mtttmpl/relative-time.php
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks'). With the argument $max_diff you can specify the number of days from when the actual date should be returned.
<?php
/**
* Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks').
* With the argument `$max_diff` you can specify the number of days from when the
* actual date should be returned witht the format of `$date_format`.
*
* Gist: https://gist.github.com/wottpal/61bc13425a8cedcd88666040d1449bfd
* Fork of: https://gist.github.com/mattytemple/3804571
*/