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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:10:37+00:00 2026-05-23T08:10:37+00:00

function show_elapsed_time(from) { var time_elapsed = new Date().getTime()-from; var date = new Date(time_elapsed); var

  • 0
function show_elapsed_time(from)
{
    var time_elapsed = new Date().getTime()-from;
    var date = new Date(time_elapsed);
    var date_elements = (pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())).split('');
    var date_string = '';

    for(i = 0; i < date_elements.length; i++)
    {
        date_string += '<div class="frame">' + date_elements[i] + '</div>';
    }

    $('#digital_clock').html(date_string);
}

show_elapsed_time(1308446047*1000)

The expected result (at the time of this post) is 0 hours, 2 minutes, .. seconds. This is as well the result given by Opera, Chrome and IE. However, Firefox returns 1 hour, 2 minutes, etc. How to fix it?

Basically:

var date = new Date(1453288); console.log(date.getHours()); // FF: 1, IE: 0, Opera 0

What I am doing is taking: new Date().getTime() - [some timestamp] == time passed
So I need to know time passed from [some timestamp] in hours, minutes and seconds.

  • 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-23T08:10:38+00:00Added an answer on May 23, 2026 at 8:10 am

    Well, the problem is with different locale browser settings. One way to solve the problem is to use UTC specific methods, e.g. getUTCTime(). Instead, I’ve written this small script to do the math:

    var time_elapsed    = new Date().getTime()-from;    
    var hours           = Math.floor(time_elapsed/(3600*1000));
    time_elapsed        -= hours*(3600*1000);
    var minutes         = Math.floor(time_elapsed/(60*1000));
    time_elapsed        -= minutes*(60*1000);
    var seconds         = Math.floor(time_elapsed/1000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: function show() { var parameters = new Object(); parameters.F1MBFC =
i have an application class inherited from QtGui.QDialog. I have to reload show-function but
I'll show you the function first. private var areaCollection:ArrayCollection; private function generateAreaCollection():void { areaCollection
I have problem with validation such code function show_help_tip(event, element) { var $e =
Here's what I got. <script type=text/javascript> function show_confirm(id) { var r=confirm(Are you sure you
function show_prompt() { var name=prompt(Please enter your name); } I am calling this function
In a Django template, I have a function function show_graph(i){ $(#+i+seegraph).click(function(){ $(#+i+graph).show(); var qaa
I am new to javascript.Itried to make this page but somehow shorten function does
I have the following HTML / JS: <html> <body> <script> function foo(){ var html
this is my code function show(placelanlat,names) { var placenames=names; var planlat=placelanlat; var newStr= planlat.replace(/[(\)]/g,'');

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.