• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

countdown on page

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
i have this script
PHP:
<?
// Define your target date here
    $targetYear   = $config['site']['year'];
    $targetMonth  = $config['site']['month'];
    $targetDay    = $config['site']['day'];
    $targetHour   = $config['site']['hour'];
    $targetMinute = $config['site']['minute'];
    $targetSecond = $config['site']['second'];
// 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));

$dateFormat = "Y-m-d H:i:s";

$targetDateDisplay = date($dateFormat,$targetDate);
$actualDateDisplay = date($dateFormat,$actualDate);
?>
and it didn't work need similar working script
 
HTML:
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- ... -->
  </head>
  <body>
    <!-- ... -->

    <div id="countdown">
      Start in
      <span>%w</span> weeks
      <span>%d</span> days
      <span>%H</span> hours
      <span>%M</span> minutes
      <span>%S</span> seconds
    </div>

    <!-- ... -->

    <script src="https://code.jquery.com/jquery.js"></script>
    <script src="https://rawgithub.com/hilios/jQuery.countdown/master/dist/jquery.countdown.min.js"></script>
    <script>
      $('#countdown').countdown('2015/01/01', function(event) {
        $(this).html(event.strftime('Start in '
          + '<span>%w</span> weeks '
          + '<span>%d</span> days '
          + '<span>%H</span> hours '
          + '<span>%M</span> minutes '
          + '<span>%S</span> seconds'));
      });
    </script>
  </body>
</html>

I think you should use script written in JavaScript instead of PHP. You can see efect here: http://codepen.io/anon/pen/wKGAc.
 
Last edited:
Try this one
PHP:
$main_content .= '<script language="JavaScript">
TargetDate = "8/20/2013 8:00 PM";
CountActive = true;
CountStepper = -1;
LeadingZero = false;
DisplayFormat = "<font size=\'3\' color=\'red\'><h1><center>ValourForce Starts after:<br/> %%D%% Days, %%H%% Hours, %%M%% Minutes %%S%% Seconds!</center></h1></font>";
FinishMessage = "<h1>ValourForce is now Online. It is finally here!</h1>";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>';

Change
Code:
TargetDate = "8/20/2013 8:00 PM";
to the start time
 
Back
Top