I work on a table of reminders and I would like to be able to show how much the record was created in my table
My table tasks :
id idusuario usuario titulo Contenido fecha Estado
1 1 juan titulo1 aaa qq 17-08-18/12:30 atendido
2 1 juan titulo2 bbb qq 07-08-18/01:21 pendiente
3 1 juan titulo1 ccc qq 05-08-18/11:22 atendiendo
4 2 pepe titulo2 ddd qq 12-08-18/04:20 pendiente
5 2 pepe titulo3 eee qq 20-08-18/10:50 canceloado
6 3 alex titulo4 fff qq 17-08-18/05:59 nadie sabe
I want that in my table where I show the compos referring to the user juan say how long ago was the record.
If the date of the first registration is: 17-08-18 / 12: 30 and today is 17-08-18 / 12: 30 say 3m and if a day has passed to show the result 1d 3m ago I am just creating the database so I can create changes on it if necessary
With a query like:
<?php
$sql_tarea = sqlsrv_query(
$conn, "SELECT tareas
FROM periodo where
idusuario=$idsuario
ORDER BY id DESC");
//$conn contiene mis datos de conecion a my base,
//y $idsuario es el id del usuario que inicio la secion
if($c=sqlsrv_fetch_array($sql)) {
$fecha=$c['fecha'];
}
?>
to be able to make $ date tell the elapsed time when it shows in an echo $ date