Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:46:52+00:00 2026-06-11T21:46:52+00:00

I have countdown which is not taking GMT time. i want it to have

  • 0

I have countdown which is not taking GMT time.

i want it to have GMT time. It seems its using London time that is +1.

live demo : http://ffsng.deewayz.in/countdown/

It seems Actual date: there has some bug or i dont know what time its taking. i want it to take GMT time and date

Here is my codes:

<?php
$dateFormat = "Y-m-d H:i:s";
$targetDate = mktime(15,00,00,9,26,2012);
$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));
$targetDateDisplay = gmdate($dateFormat,$targetDate);
$actualDateDisplay = gmdate($dateFormat,$actualDate);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FFSng Raid Countdown</title>
<link rel="stylesheet" type="text/css" href="/countdown/css.css"/>
<link href="style/style.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
var days = <?php echo $remainingDay; ?>;
var hours = <?php echo $remainingHour; ?>;  
var minutes = <?php echo $remainingMinutes; ?>;  
var seconds = <?php echo $remainingSeconds; ?>;

function setCountDown ()
{
  seconds--;
  if (seconds < 0){
      minutes--;
      seconds = 59;
  }
  if (minutes < 0){
      hours--;
      minutes = 59;
  }
  if (hours < 0){
      days--;
      hours = 23;
  }
  document.getElementById("remain").innerHTML = days+" days, "+hours+" hours, "+minutes+" minutes, "+seconds+" seconds";
  setTimeout ( "setCountDown()", 1000 );
}
</script>


</head>
<center>
<body onload="setCountDown();">
<div id="container">
    <div id="header"><div id="header_left"></div>
    <div id="header_main"><span class="red"><h2>FFSng Raid Countdown</h2></span></div><div id="header_right"></div></div>
    <div id="content">
        <table class="countTable">
           <tr><td><span class="points">Target date:</td><td><?php echo $targetDateDisplay; ?></span></td></tr>
           <tr><th colspan="2" id="remain"><?php echo "$remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds";?></th></tr>
           <tr><td>Actual date:</td><td><?php echo $actualDateDisplay; ?></td></tr>
       </table>
    </div>
</div>
</body>
</center>
</html>

2nd issue come up

But now it giving 1 hour less:
Output :

Target date: 2012-09-26 14:00:00

But i have set

$targetDate = mktime(15,00,00,9,26,2012);

Fixed code:

<?php
$dateFormat = "Y-m-d H:i:s";
$targetDate = gmmktime(15,00,00,9,26,2012);
$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));
$targetDateDisplay = gmdate($dateFormat,$targetDate);
$actualDateDisplay = gmdate($dateFormat,$actualDate);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FFSng Raid Countdown</title>

<script type="text/javascript">
var days = <?php echo $remainingDay; ?>;
var hours = <?php echo $remainingHour; ?>;  
var minutes = <?php echo $remainingMinutes; ?>;  
var seconds = <?php echo $remainingSeconds; ?>;

function setCountDown ()
{
  seconds--;
  if (seconds < 0){
      minutes--;
      seconds = 59;
  }
  if (minutes < 0){
      hours--;
      minutes = 59;
  }
  if (hours < 0){
      days--;
      hours = 23;
  }
  document.getElementById("remain").innerHTML = days+" days, "+hours+" hours, "+minutes+" minutes, "+seconds+" seconds";
  setTimeout ( "setCountDown()", 1000 );
}
</script>


</head>
<center>
<body onload="setCountDown();">
<div id="container">
    <div id="header"><div id="header_left"></div>
    <div id="header_main"><span class="red"><h2>FFSng 100 token Raid Countdown</h2></span></div><div id="header_right"></div></div>
    <div id="content">
        <table class="countTable">
           <center><img src="http://ffsng.com/images/ffsng_big.gif" width="400" height="240"></center>
           <tr><td>Target time and date:</td><td><?php echo $targetDateDisplay; ?></td></tr>
           <tr><th colspan="2" id="remain"><?php echo "$remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds";?></th></tr>
           <tr><td>Actual time and date:</td><td><?php echo $actualDateDisplay; ?></td></tr>
       </table>
    </div>
</div>
</body>
</center>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:46:53+00:00Added an answer on June 11, 2026 at 9:46 pm

    To get GMT/UTC date-time values, use gmdate instead of date.

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

    The date function does two things:

    First, it converts the Unix Timestamp (which is a UTC value anyway) into the computer local timezone.
    Secondly it then converts this local value into a string representation using the supplied format string.

    The gmdate function, on the other hand, merely creates a string representation without doing any timezone conversion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building something which has a countdown to a certain date/time. I have it
I have a JFrame on which I want to simulate a countdown (like a
Using NSTimer for my application in which I have to show countdown timer with
I have an application which displays countdown of time left for user to perform
In my android project, I have a countdown that randomizes a boolean for an
I have got a piece of code, that should countdown some number (in this
have written this little class, which generates a UUID every time an object of
I have a GridView which is continually rebound using a timer and is within
I have a application which has 6 count down timers. I want the application
In my iPhone app I want to have a UILabel which counts down to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.