Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/12/2013, 18:59
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Respuesta: duda con date strtotime y variable

Prueba esto, a strtotime necesitas pasarle una fecha valida no solo un mes.

Código PHP:
Ver original
  1. $month = '01';
  2. $year = '2012';
  3. // Crea una Fecha valida para convertir.
  4. $dateToCheck = '01-'.$month.'-'.$year;
  5.  
  6. // Fecha normal Output: January 2012
  7. var_dump( date('F Y', strtotime( $dateToCheck )) );
  8.  
  9. // Menos 1 mes Output: December 2011
  10. var_dump( date('F Y', strtotime( $dateToCheck .' -1 month' ) ));