By Buddel
Tyler Muth has a useful addition to the date functions I have published here before.
If you ever want to know how long ago a date is and you want to display it in ‘human readable’ format you (and I) could use his function.
Like this:
select date_text_format(sysdate - 3/86400) the_date from dual; select date_text_format(sysdate - 5/1440) the_date from dual; select date_text_format(sysdate - 1/24) the_date from dual; select date_text_format(sysdate - 3.141549) the_date from dual; select date_text_format(sysdate - 15) the_date from dual; select date_text_format(sysdate - 120) the_date from dual; select date_text_format(sysdate - 365) the_date from dual; -------------------------------------------------------------------- 3 seconds ago 5 minutes ago 1 hour ago 3 days ago 2 weeks ago 4 months ago 1 year ago
One more for the toolbox.
Via:: Klein Oracle Denkraam