Ver Mensaje Individual
  #6 (permalink)  
Antiguo 12/05/2012, 01:21
IXtremeLT
 
Fecha de Ingreso: julio-2011
Ubicación: Zapopan, Jal. MX
Mensajes: 316
Antigüedad: 12 años, 10 meses
Puntos: 32
Respuesta: Test de Conocimiento, problema de prueba

Código PHP:
Ver original
  1. function nextWDayFor($customWDays, $outputFormat)
  2. {
  3.     $incDay = 0;
  4.     while(1) {
  5.         $nextTDay = strtotime('+'.$incDay.' day');
  6.         $nextWDay = date('D', $nextTDay);
  7.         foreach ( $customWDays as $cWDay ) {
  8.             if ( $nextWDay == $cWDay ) {
  9.                 return date($outputFormat, $nextTDay);
  10.             }
  11.         }
  12.         $incDay++;
  13.     }
  14. }
  15.  
  16. var customWeekDays =array('Mon', 'Wed', 'Fri');
  17. echo nextWDayFor($customWeekDays, 'D, M Y'); // Mon, May 2012, contando la fecha de este post.

Última edición por IXtremeLT; 12/05/2012 a las 01:39