ForKmaN
03-03-2002, 10:04 AM
Belwo is some code for a Countdown:
<?
$day = 10; // Day of the countdown
$month = 4; // Month of the countdown
$year = 2002; // Year of the countdown
// mktime is the marked time, and time() is the current time.
$target = mktime(0,0,0,$month,$day,$year);
$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;
printf("There are $days days, $hours hours, $minutes minutes, $seconds seconds until the next team meeting!");
?>
The problem is that is is the same for all timezones, I was wondering how I could make it work with all timzeones so teh countdown is different depending on what time zone your in and what timezone it is originally set on..
Thanks! If I get this working it shall lead toa vB hack ;)
<?
$day = 10; // Day of the countdown
$month = 4; // Month of the countdown
$year = 2002; // Year of the countdown
// mktime is the marked time, and time() is the current time.
$target = mktime(0,0,0,$month,$day,$year);
$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;
printf("There are $days days, $hours hours, $minutes minutes, $seconds seconds until the next team meeting!");
?>
The problem is that is is the same for all timezones, I was wondering how I could make it work with all timzeones so teh countdown is different depending on what time zone your in and what timezone it is originally set on..
Thanks! If I get this working it shall lead toa vB hack ;)