joan16v

29 julio 2013

PHP: Obtener los 7 días de la semana dado el número de la semana

Filed under: General — joan16v @ 10:57

function week_bounds( $date, &$start, &$end ) {
$date = strtotime( $date );
// Find the start of the week, working backwards
$start = $date;
while( date( 'w', $start ) > 1 ) {
$start -= 86400; // One day
}
// End of the week is simply 6 days from the start
$end = date( 'Y-m-d', $start + ( 6 * 86400 ) );
$start = date( 'Y-m-d', $start );
}

Anuncios

Crea un blog o un sitio web gratuitos con WordPress.com.