Du bist nicht angemeldet.
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
<?
$today = date("w");
if($today == 0) $today = 7;
$wa = 1;
$wa -= $today;
$wa_day = dateadd("w", $wa, time());
$we = dateadd("w", 4, $wa_day); //Freitag
$tag = "01";
$monat = "03";
$jahr = "2005";
$stunde = 0; //Stunde
$minute = 00; //Minute
$sekunde = 00; //Sekunden
$target = mktime($stunde,$minute,$Sekunden,$monat,$tag,$jahr);
$diff = $target - time();
$days = ($diff - ($diff % 86400)) / 86400;
$diff = $diff - ($days * 86400);
$hours = ($diff - ($diff % 3600)) / 3600;
$diff = $diff - ($hours * 3600);
$minutes = ($diff - ($diff % 60)) / 60;
$diff = $diff - ($minutes * 60);
$seconds = ($diff - ($diff % 1)) / 1;
$countdown = "Es sind noch <b>$days</b> Tage, <b>$hours</b> Stunden, <b>$minutes</b> Minuten bis zum grossem Anlassen";
eval ("\$boxlinks[]= \"".$countdown."\";");
function DateAdd ($interval, $number, $date) {
$date_time_array = getdate($date);
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
switch ($interval) {
case "w":
$day+=$number;
break;
}
$timestamp = mktime($hours ,$minutes, $seconds,$month ,$day, $year);
return $timestamp;
}
?>
|
|
|
Quellcode |
1 |
$boxlinks[] = sprintf('<div style="text-align: center">Es sind noch <b>%d</b> Tage, <b>%d</b> Stunden, <b>%d</b> Minuten bis zum grossem Anlassen</div>', $days, $hours, $minutes);
|
Zitat von »Hayes«
[...]
Ich hab mir vor einiger Zeit mal ein kleines Countdown PHP Script gegoogelt, das "noch soundsoviel Tage bis..." anzeigt.
[...]
![]()
Quellcode
1 2 3<?php print ("Noch " . (int) ((mktime (0,0,0,12,10,2004) - time(void))/86400) . " Tage"); ?>
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 |
// target $day = 23; $month = 3; $year = 2005; // time to go $seconds = mktime(0, 0, 0, $month, $day, $year) - time(); $days = (int) ($timeleft / ($seconds * 60 * 60 * 24)); $hours = (int) ($timeleft / ($seconds * 60 * 60)); $minutes = (int) ($timeleft / ($seconds * 60)); |

-