Mailinglisten-Archive |
Sebastian Bergmann wrote: > Mir wurde bereits geholfen, trotzdem danke. Hier die Lösung: $day_names = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); $day_duration = 3600 * 24; $week_duration = $day_duration * 7; $start = 0; // 1.1.1970 $time = intval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()) - $start); // Now we have the seconds $elapsed_weeks = intval($time / $week_duration); $newdays = intval(($time % $week_duration) / $day_duration); $day_count = array($elapsed_weeks, $elapsed_weeks, $elapsed_weeks, $elapsed_weeks, $elapsed_weeks, $elapsed_weeks, $elapsed_weeks); $startday = date("w", $start) + 1; for ($i = $startday; $i < $startday + $newdays; $i++) $day_count[$i % 7]++; for ($i=0; $i < 7; $i++){ echo "$day_names[$i]: $day_count[$i]<br>"; } -- sebastian bergmann e-mail : sb_(at)_sebastian-bergmann.de homepage : http://www.sebastian-bergmann.de make a gift : http://wishlist.sebastian-bergmann.de measure the usability of your web application -> http://phpOpenTracker.de
php::bar PHP Wiki - Listenarchive