Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Hago la consulta etc... y esta es la variable donde almacenaré la fecha
- $fec_ = transcurridoPublicacion($fila['Prod_Fec']);
- function transcurridoPublicacion($fecha){
- $fecha2 = date("Y-m-d H:i:s");
- $fechaF = date_diff($fecha, $fecha2);
- return $fechaF;
- }
- function transcurridoPublicacion($fecha){
- $fecha1 = date($fecha);
- $fecha2 = new DateTime('2011-01-03 17:13:00');
- $fechaF = $fecha->diff($fecha2);
- // Lo siguiente es por si quieres ponerlo ya en texto la diferencia
- // $elapsed = $interval->format('%y años %m meses %a dias %h horas %i minutos %S segundos');
- // return $elapsed;
- return $fechaF;
- }
- $fechaF = $fecha->diff($fecha2);
- print $fechaF->format("%H:%I:%S");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement