Ver Mensaje Individual
  #10 (permalink)  
Antiguo 04/02/2014, 16:11
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: error al comparar fechas

Cita:
Iniciado por Briss Ver Mensaje
lo puse asi

Código PHP:
$hoy strtotime (date("y-m-d")); 
no hay error en hacerlo asi???
y mi fecha vence la obtengo de una consulta (solo el dia y el mes por separado)
$mv = $row_consulta['Mes'];
$dv = $row_consulta['Dia'];
$fechavence=$dv.'/'.$mv2.'/'.$yy;

aca no sé como meter

strtotime
Pues para eso es la documentación para saber como usar las funciones que proporciona php:
http://www.php.net/manual/en/function.strtotime.php
Código PHP:
Ver original
  1. $fechavence="{$dv}-{$mv2}-{$yy}";
  2. $fecha_vence = strtotime($fechavence);
La razon por la que cambien tus '/' en la fecha es por la siguiente nota en el manual:
Cita:
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
To avoid potential ambiguity, it's best to use ISO 8601 (YYYY-MM-DD) dates or DateTime::createFromFormat() when possible.
Para evitar ambiguedad al usar / en el formato
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.