Click to See Complete Forum and Search --> : Year´s month´s names


amrigo
09-05-2005, 02:55 PM
<?
function generatecalendar() {
$ano = date('Y');
print ($ano-1);
echo " | | ";
for($i;$i<=12;$i++){
echo $i." | ";
}
echo " | | ";
print ($ano+1);
}

generatecalendar();
?>
Hi

I would like to generate a mini calendar displaying a year before the actual year number the 12 months from the year and the year number after the actual year. The function above generate the months number.

i would like to generate the three first letters from the months but in portuguese ! how can i do this ?

Thank´s in advance

SpectreReturns
09-05-2005, 03:17 PM
Make an array containing the first three letters of each month, then use your month number to access the correct one.

cyber1
09-05-2005, 04:46 PM
Or you could just use the follwing:
-Bill
<?php
$years_back=1;
$years_togo=2;
$duaration = ($years_togo*12);
for($i=1;$i<$duaration;$i++){
print date('M d,Y',mktime(0, 0, 0, $i, 1, date('Y')-$years_back))."|\n";
}

bokeh
09-05-2005, 07:51 PM
I've used your code here but just made a minor change:<?php

function generatecalendar()
{
$ano = date('Y');
print ($ano-1);
echo " | | ";

$meses = array('1' => 'Ene', 'Feb', 'Mar', 'Abr', 'May',
'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic');

for($i = 1;$i<=12;$i++){
echo $meses[$i]." | ";
}
echo " | | ";
print ($ano+1);
}

generatecalendar();

?>

amrigo
09-06-2005, 07:28 AM
thank´s i have used a switch i will try the array.