I need to generate an html code of a list of 10 open days following the current day, by open days I mean business days (m,t,w,t and f), I’m using the following function to translate the date to french:
function f_date() {
$temps = time();
$jours = array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
$jours_numero = date('w', $temps);
$jours_complet = $jours[$jours_numero];
$NumeroDuJour = date('d', $temps);
$mois = array(' ', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
$mois_numero = date("n", $temps);
$mois_complet = $mois[$mois_numero];
$an = date('Y', $temps);
$fr_temps = "$jours_complet, $NumeroDuJour $mois_complet $an";
return "$fr_temps";
}
echo "<br/>".f_date();
And i want to generate the following result:
<select name="ladate">
<option selected="selected" value="Mardi, 29 mai 2012">29 mai 2012</option>
<option value="Mercredi, 30 mai 2012">30 mai 2012</option></select>
....
<option value="Vendredi, 15 juin 2012">15 juin 2012</option></select>
</select>
Please tell me if you need further information.
Thank you.
Just create a loop, increase the days up to ten and ignore all non open days (Sat, Sun).
date('N')is your friend to detect the weekday of a given date.You also have to modify your
date_f()function to use$tempsas parameter.