note 31124 added to function.strftime

From: Date: Thu, 10 Apr 2003 13:29:04 +0000
Subject: note 31124 added to function.strftime
Groups: php.notes 
Request: Send a blank email to php-notes+get-46450@lists.php.net to get a copy of this message
The next script print the week and day begin and end of the week <? $duracion = 12; $dia = '05'; $mes = '03'; $anio = '2003'; $fecha_inicio = mktime(0,0,0,$mes,$dia,$anio); $semana_inicio = strftime("%W", mktime(0,0,0,$mes,$dia,$anio)); $dia_semana_inicio =strftime("%u", mktime(0,0,0,$mes,$dia,$anio)); echo "Fecha Inicio :: {$dia}/{$mes}/{$anio}<br>"; echo "semana :: {$semana_inicio} <br>"; echo "Dia Semana Inicio :: {$dia_semana_inicio} <br>"; $x_ini = ($dia_semana_inicio > 1) ? ($fecha_inicio - ($dia_semana_inicio-1)* 86400) : ($fecha_inicio) ; for($i=0;$i<=$duracion;$i++){ $y_ini = (int) $x_ini + ($i*7*86400); $y_fin = (int) $x_fin + ($i*7*86400); echo "Semana :: ".strftime("%V", mktime(0,0,0,date("m", $y_ini), date("d", $y_ini), date("Y", $y_ini) )) . " :: [ " . date("d-m-Y", $y_ini) ."/" .date("d-m-Y", $y_fin)." ]<br>"; } ?> -- http://www.php.net/manual/en/function.strftime.php http://master.php.net/manage/user-notes.php?action=edit+31124 http://master.php.net/manage/user-notes.php?action=delete+31124 http://master.php.net/manage/user-notes.php?action=reject+31124

« previous php.notes (#46450) next »