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 7052383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:22:35+00:00 2026-05-28T03:22:35+00:00

I am trying to create a javascript countdown timer; I have a string that

  • 0

I am trying to create a javascript countdown timer;

I have a string that is in the format of YYYY-MM-DD HH:MM:SS .

This could be any time up to 6 months in the future.

What would be the best way to go about getting the time remaining in seconds from now until the future time. This could be implemented in PHP.

Thanks in advance!

  • 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-05-28T03:22:36+00:00Added an answer on May 28, 2026 at 3:22 am

    In PHP you can use strtotime, which takes a string representation of a date and returns the unix timestamp.

    Then use microtime to get the current unix timestamp, and find the difference. This will be the number of milliseconds remaining, so divide it by 1000 to get it in seconds.

    http://php.net/manual/en/function.strtotime.php
    http://php.net/manual/en/function.microtime.php

    This should work:

    $currentTime = explode(" ", microtime());
    $currentTime = $currentTime[1];
    $futureTime = strtotime("YYYY-MM-DD HH:MM:SS"); // insert your date here
    $timeRemaining = ($futureTime - $currentTime) / 1000;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a countdown timer that's based on a time on the
I'm trying to create a simple timer in javascript that counts down from 5
I'm trying to create a javascript function that can take a fraction input string
I am trying to create a countdown using javascript. I got some code from
I'm trying to create a small Javascript framework that I can use in my
I am trying to create a checkbox dynamically using following HTML/JavaScript. Any ideas why
Im trying to find out a good JavaScript library that can create a nice
I'm trying to create javascript closure that will tell me if the function has
I am trying to create a Javascript function that will return all javascript files
I am trying to create a JavaScript regular expression that can find a keyword

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.