note 26671 deleted from function.getdate by maxim
| From: | maxim@php.net | Date: | Fri, 08 Nov 2002 17:10:04 +0000 |
| Subject: | note 26671 deleted from function.getdate by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39180@lists.php.net to get a copy of this message | ||
<select name="from">
<option value="Select" SELECTED>- Zeitraum Von</option>
<? $today = getdate();
for ( $idat = 0; $idat <= 300; $idat++ ) {
if ( $today["mon"] < 8 ) {
if ( $today["mon"] % 2 ) $mlen = 31;
else if ( $today["mon"] == 2 ) {
if ( $today["year"] % 4 ) $mlen = 28;
else $mlen = 29;
} else $mlen = 30;
} else {
if ( $today["mon"] % 2 ) $mlen = 30;
else $mlen = 31;
}
if ( $today["wday"] == 2 ) { $today["mday"]++;
$today["wday"]++; }
if ( $today["wday"] == 3 ) { $today["mday"]++;
$today["wday"]++; }
$today["mday"]++; $today["wday"]++;
if ( $today["wday"] > 6 ) $today["wday"] =
$today["wday"] - 7;
if ( $today["mday"] > $mlen ) {
$today["mday"] = $today["mday"] - $mlen;
$today["mon"]++;
if ( $today["mon"] > 12 ) {
$today["mon"] = 1;
$today["year"]++;
}
}
switch ( $today["wday"] ) {
case 0: $daystring = "Sonntag"; break;
case 1: $daystring = "Montag"; break;
case 2: $daystring = "Dienstag"; break;
case 3: $daystring = "Mitwoch"; break;
case 4: $daystring = "Donnerstag"; break;
case 5: $daystring = "Freitag"; break;
case 6: $daystring = "Samstag"; break;
}
$datestring = sprintf( "%02u-%02u-%04u %s",
$today["mday"], $today["mon"],
$today["year"], $daystring);
?><option
value="<?=$datestring?>"><?=$datestring?></option><?
}
?>
</select>