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

  • Home
  • SEARCH
  • 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 9112343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:42:46+00:00 2026-06-17T03:42:46+00:00

I am in need of virtual time (4 x current date and time). I

  • 0

I am in need of virtual time (4 x current date and time). I have managed to display the running clock with the current date and time, but I am unable to the time four times faster than current time.

For example, if the current date is 01-01-2012 00:00:00, the virtual time should
be 01-01-2012 00:00:04

Not only the seconds alone should get multiplied; the corresponding minutes, hours, date, month and year also should get multiplied when seconds crosses 59 virtual seconds. That is, the clock should run live with incremental of four seconds for every second with my date format.

Please see my page: http://www.chemfluence.org.in/sample.html

It’s now running with the current time. I want to run this four times faster.

Please see my code below.

<!DOCTYPE html>
<html>
    <head>
        <script>
            function startTime()
            {
                var today = new Date();
                var h = today.getHours();
                var m = today.getMinutes();
                var s = today.getSeconds();
                // Add a zero in front of numbers<10
                m = checkTime(m);
                s = checkTime(s);
                document.getElementById('txt').innerHTML =
                    today.getDate() +
                    "-" +
                    (today.getMonth()+1)+"-" +
                    today.getFullYear() +
                    " "+h+":"+m+":"+s;
                t = setTimeout(function(){startTime()},500);
            }

            function checkTime(i)
            {
                if (i<10)
                {
                    i = "0" + i;
                }
                return i;
            }
        </script>
    </head>

    <body onload="startTime()">
        <div id="txt"></div>
    </body>
</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-17T03:42:48+00:00Added an answer on June 17, 2026 at 3:42 am

    There is a simple formula to determine the virtual time for every given time, knowing the two timestamps and the factor:

    var virtualOrigin = Date.parse("2012-01-01T00:00:04"),
        realOrigin = Date.parse("2012-01-01T00:00:00"),
        factor = 4;
    
    function getVirtual(time) {
        return new Date( virtualOrigin + (time - realOrigin) * factor );
    }
    
    // usage:
    var now = new Date(),
        toDisplay = getVirtual(now);
    

    Demo at jsfiddle.net

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

Sidebar

Related Questions

I have a bunch of virtual machines that I need to update from time
I need to display the virtual keyboard when the application starts, but so far
I am using virtual machines for development,but each time I need a new VM,
I have a .NET 2.0 class the properties of which are marked virtual.I need
I managed to set up virtual hots on my local machine, but I kinda
I'm looking at using ELMAH for the first time but have a requirement that
I understand the need for a virtual destructor. But why do we need a
This time I have problem with virtual fields. I have core class for my
This time I have problem with virtual fields. I have core class for my
Is it possible in C++ to have a class override a virtual function, but

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.