PHP from_time() – a human readable time span phrase

I’m sure this has been done many times before, but I wanted something to turn a date time string like ‘2 days and 9 hours ago’ to give the last deployment time on a little git deploy tool I’m working on in my spare time.

Here’s the code…

Joining text in SQL

A handy function for concatenating cells in SQL.
CREATE OR REPLACE function join
p_cursor sys_refcursor,
p_del varchar2 := ‘; ‘
) return varchar2
l_value varchar2(32767);
l_result varchar2(32767);
fetch p_cursor into l_value;
exit when p_cursor%notfound;
if l_result is not null then
l_result := l_result || p_del;
end if;
l_result := l_result || l_value;
end loop;
close p_cursor;
return l_result;
end join;