hi all,
have some question on displaying a countdown system
i have the following code

// Define your target date here
    $targetYear   = 2011;
    $targetMonth  = 9;
    $targetDay    = 10;
    $targetHour   = 12;
    $targetMinute = 00;
    $targetSecond = 00;
// End target date definition

$targetDate = mktime($targetHour,$targetMinute,$targetSecond,$targetMonth,$targetDay,$targetYear);
$actualDate = time();

$secondsDiff = $targetDate - $actualDate;

$remainingDay     = floor($secondsDiff/60/60/24);
$remainingHour    = floor(($secondsDiff-($remainingDay*60*60*24))/60/60);
$remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60);
$remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));

// Define date format
$dateFormat = "Y-m-d H:i:s";

$targetDateDisplay = date($dateFormat,$targetDate);
$actualDateDisplay = date($dateFormat,$actualDate);


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
 TARGET DATE : <?php echo $targetDateDisplay; ?><br/><br/>
 ACTUAL DATE : <?php echo $actualDateDisplay; ?><br/><br/>
 REMAINING   : <?php echo "$remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds";?>

and it will show this

TARGET DATE : 2011-09-10 12:00:00

ACTUAL DATE : 2011-01-03 19:58:34

REMAINING : 249 days, 16 hours, 1 minutes, 26 seconds

now i want to have a box which will show the remaining time and will auto refresh itself,what should i add to the display function?
thank for help

Edited by pritaeas: Added markdown.

6 Years
Discussion Span
Last Post by diafol

u can do it with javascript it have that implemented
and i m sorry i dont have that expereince in javascript to redirect ya

go and google it and u will find it

good luck


that website is using javascript as well,
actually i have the countdown function and i need to know how to create a page to show the time by calling the countdown function...
anw..thx you guys

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.