Fechas fechas

<?php $inicio = new DateTime(); $inicio->modify('first day of this month'); $inicio = $inicio->format('d-m-Y'); $final = new DateTime(); $final->modify('last day of this month'); $final = $final->format('d-m-Y'); $dias = (strtotime($final) - strtotime($inicio))/84000; $dias = ceil($dias); $i = 1; while($i <= $dias){ $dia = date('N', strtotime($inicio)); echo $inicio." ".$dia. "<br>"; $inicio = strtotime ( '+1 day' , strtotime ( $inicio ) ) ; $inicio = date ( 'd-m-Y' , $inicio ); $i++; } function fecha_castellano($a){ setlocale(LC_TIME, "es_ES.UTF-8"); $d = $a; $dia=strftime("%A", strtotime($d)); if (strcmp($dia, "sado") == 0) { $dia1="Sábado"; $fecha = strftime("%d de %B de %Y", strtotime($d)); return ucfirst($dia1." , ".$fecha); }else{ if (strcmp($dia, "micoles") == 0) { $dia1="Miércoles"; $fecha = strftime("%d de %B de %Y", strtotime($d)); return ucfirst($dia1." , ".$fecha); }else{ $fecha = strftime("%A , %d de %B de %Y", strtotime($d)); return ucfirst($fecha); } } } $inicio = $_GET['txtFecha']; $fin = strtotime ( '+1 day' , strtotime ( $inicio ) ) ; $fin = date ( 'Y-m-d' , $fin ); //$datetime1 = date_create($inicio); //fecha actual //$datetime2 = date_create($final); //fecha de db //$interval = date_diff($datetime1, $datetime2,false); //$dias = intval($interval->format('%R%a')); ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.