Foros del Web » Programando para Internet » PHP »

Mes y días en español

Estas en el tema de Mes y días en español en el foro de PHP en Foros del Web. Hola, aquí con la bronca de los calendarios tengo este código <? include('admin/dbconn.php'); include('functions/functions.php'); include('header.php'); $type = CAL_GREGORIAN; $month = $_GET['month']; if(!$_GET['month']) { $month = ...
  #1 (permalink)  
Antiguo 28/06/2010, 16:14
 
Fecha de Ingreso: octubre-2009
Ubicación: México, D.F.
Mensajes: 20
Antigüedad: 14 años, 6 meses
Puntos: 0
Mes y días en español

Hola, aquí con la bronca de los calendarios tengo este código

<?

include('admin/dbconn.php');
include('functions/functions.php');

include('header.php');

$type = CAL_GREGORIAN;

$month = $_GET['month'];
if(!$_GET['month']) { $month = date('n'); } // Month ID, 1 through to 12.

$year = $_GET['year'];
if(!$_GET['month']) { $year = date('Y'); } // Year in 4 digit 2009 format.

$today = date('Y/n/d');

$day_count = cal_days_in_month($type, $month, $year); // Get the amount of days in the chosen month to give to our function.

echo "<div id='calendar'>";
echo "<div id='calendar_wrap'>";

// Function for year change. //

$last_month = $month - 1;
$next_month = $month + 1;

$last_year = $year - 1;
$next_year = $year + 1;

if($month == 12) {
$change_year = $year;
$change_month = $last_month;
} elseif($month == 1) {
$change_year = $last_year;
$change_month = '12';
} else {
$change_year = $year;
$change_month = $last_month;
}

if($month == 1) {
$change_year_next = $year;
$change_month_next = $next_month;
} elseif($month == 12) {
$change_year_next = $next_year;
$change_month_next = '1';
} else {
$change_year_next = $year;
$change_month_next = $next_month;
}

// Do NOT edit the above. //

echo "<div class='title_bar'>";

echo "<a href='calendar.php?month=". $change_month ."&year=". $change_year ."'><div class='previous'></div></a>";
echo "<a href='calendar.php?month=". $change_month_next ."&year=". $change_year_next ."'><div class='next'></div></a>";
echo "<h2 class='month'>" . date('F', mktime(0,0,0,$month,1)) . "&nbsp;" . $year . "</h2>";


echo "</div>";

for($i=1; $i<= $day_count; $i++) { // Start of for $i

$date = $year.'/'.$month.'/'.$i;

$get_name = date('l', strtotime($date));

$month_es = array("January" => "Enero", "February" => "Febrero", "March" => "Marzo", "April" => "Abril", "May" => "Mayo", "June" => "Junio","July" => "Julio","August" => "Agosto","September" => "Septiembre","October" => "Octubre","November" => "Noviembre","December" => "Diciembre");

$month_name = date('F', strtotime($date));

$day_name = substr($get_name, 0, 3); // Trim day name to 3 chars

$count = count_events($i,$month,$year);

echo "<a href='day_view.php?day=$i&month=$month&year=$year' title='$i $month_name' rel='day_view'>";
echo "<div class='cal_day'>"; // Calendar Day

echo "<div class='day_heading'>" . $day_name . "</div>";

if($count >= 1) { echo "<div class='day_count'><span class='event'>" . $count . "</span></div>"; }

if($today == $date) {
echo "<div class='day_number today'>" . $i . "</div>";
} else {
echo "<div class='day_number'>" . $i . "</div>";
}

echo "</div>";
echo "</a>";

} // EOF for $i

echo "</div>";
?>
<!--
<script type="text/javascript">
$(document).ready(function(){ $("a[rel='day_view']").colorbox({width:"480px", height:"450px", iframe:true}); });
</script>
-->


Ahora, necesito que los meses estén es español, cómo le puedo hacer?
Ya hice un array con los meses y he tratado de sustituir la variable $month_name por $month_es pero no me funciona.
Cómo ven?
  #2 (permalink)  
Antiguo 28/06/2010, 20:56
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 15 años, 7 meses
Puntos: 31
Respuesta: Mes y días en español

aquí te dejo otro quizás lo quieras usar

Código PHP:
<?php
function fecha(){
$GetD getdate();
$verd = array(
"Domingo","Lunes","Martes","Mi&eacute;rcoles","Jueves","Viernes","Sábado"
);
$verm = array(
"Diciembre","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre"
);
return 
$verd[$GetD['wday']].", ".$GetD['mday']." de ".$verm[$GetD['mon']]." del ".$GetD['year'];
}
echo 
fecha();
?>
Imprime, Lunes, 28 de Junio del 2010


-
__________________
╬-----╬
║☺₧☻║
╬-----╬

Etiquetas: español
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:59.