Ver Mensaje Individual
  #8 (permalink)  
Antiguo 21/08/2014, 13:09
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 10 meses
Puntos: 379
Respuesta: Restar fechas entre date() de php y date de Mysql

Código PHP:
Ver original
  1. date_default_timezone_set('America/Mexico_City');
  2.  
  3. $hoy = new DateTime();
  4. $vencimiento = new DateTime($result_ar['vencimiento']);
  5. $total = $hoy->diff($vencimiento)->format('%a');
  6.  
  7. echo $hoy->format('d/m/Y').'<br>';
  8. echo $vencimiento->format('d/m/Y').'<br>';
  9. echo $total.'<br>';
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.