Ejemplo n.º 1
0
 public function listarEstadoCola($id_lugar)
 {
     try {
         $sql = "select co.idcola,co.dni,co.fecha,co.estado,onp.nombres from cola co";
         $sql .= " inner join onpe onp on co.dni = onp.dni where co.idlugar=" . $id_lugar . " order by co.idcola desc limit 5";
         $sentencia = $this->dblink->prepare($sql);
         $sentencia->execute();
         $resultado = $sentencia->fetchAll(PDO::FETCH_ASSOC);
         $array = array();
         $i = 0;
         $trans = "";
         foreach ($resultado as $key => $value) {
             $array[$i]["idcola"] = $value["idcola"];
             $array[$i]["dni"] = $value["dni"];
             $array[$i]["estado"] = $value["estado"];
             $array[$i]["nombres"] = $value["nombres"];
             $array[$i]["fecha"] = TiempoTranscurrido::timeago(strtotime($value["fecha"]));
             $i++;
         }
         return $array;
         //return $resultado;
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 2
0
<?php

require_once "../negocio/TiempoTranscurrido.php";
$date = '2015-12-06 01:28:04';
$hoy = '2015-12-06 03:28:04';
echo $hoy;
$unix = strtotime($date);
$res = TiempoTranscurrido::timeago(strtotime($date));
echo $res;
echo "<br>";
//echo date_diff($hoy,$date);
//echo date("Y-m-d H:i:s")->diff($date);
//$datetime1->diff($datetime2);