Is it possible to load a timestamp from mysql database, subtract it with current timestamp(if needed) and convert it into something like a minute ago, 2 minutes ago, a hour ago, etc ? I need help to display the timestamp with that format.
<?php
function getuser_get($dt)
{
$query="SELECT huffid,fullname, photourl, gender, country, city, lastupdate, dob,
concat('[',(select GROUP_CONCAT('{".'"sportname.":"'."',sportname,'".'"}'."' SEPARATOR ',')
from personal_sport inner join sports on
personal_sport.sportid=sports.id where personal_sport.huffid=personal.huffid),']')
as sports FROM personal
order by fullname asc
limit 20;";
return $query;
}
?>
in mysql database, the lastupdate
column format is like this 2018-06-21 01:05:07
, and i need to convert it into "time ago" dynamically each time the app is being refreshed. Can anyone help, please? Thank you in advance.