Display a relative date (e.g. "4 days ago")
Relative dates are where, instead of showing the exact date of a post, you can say it was posted "4 days ago." Tomorrow, this message would say "5 days ago." This plugin, originally named WP Relative Date, has been designed to be called from your theme to display these relative dates as required.
It is based on code from a number of sites (none of which can be proven to be the originator!) but has been improved and converted to work with WordPress.
All relative dates are shown up to 2 depths and are not designed to be 100% accurate (due to rounding), but rather to give the reader an idea as to how old something is.
The dates will be shown in one the following formats, depending on relevance...
Something that is 1 years and 2 months and 3 weeks old will be output as "1 years, 2 months". Something that is 1 years and 0 months and 3 weeks old will be output as "1 years, 3 weeks".
To use, you simply call either
relative_date - the first will return the relative date and the second will output it.
No parameters are required and if none are specified then it will simply create a relative date for the current post or page based on how old it is. However, you can specify as the first or second parameter a Unix format date (more on that in a minute). If one is supplied then the difference will be between that and the current date. If a second date is specified then the output will be the difference between the 2 dates.
For advanced usage options please read the "Other Notes" tab.
Requires: 2.5 or higher
Compatible up to: 4.3.4
Last Updated: 6 months ago
Active Installs: 100+
Got something to say? Need help?