How to calculate difference between two timestamps using javascript












-2














I have two timestamps and I need difference between them in hours. How to calculate them.






var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)












share|improve this question
























  • I'm assuming the sla prefix is an issue with copying your code to SO?
    – George
    Nov 21 '18 at 13:26






  • 1




    Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
    – Gerard
    Nov 21 '18 at 13:27






  • 1




    That's not a duplicate... the time here is not in 24 hour format
    – Oram
    Nov 21 '18 at 13:28










  • First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
    – Raja Mohamed
    Nov 21 '18 at 13:30






  • 1




    Possible duplicate of Get difference between 2 dates in JavaScript?
    – adiga
    Nov 21 '18 at 13:37
















-2














I have two timestamps and I need difference between them in hours. How to calculate them.






var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)












share|improve this question
























  • I'm assuming the sla prefix is an issue with copying your code to SO?
    – George
    Nov 21 '18 at 13:26






  • 1




    Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
    – Gerard
    Nov 21 '18 at 13:27






  • 1




    That's not a duplicate... the time here is not in 24 hour format
    – Oram
    Nov 21 '18 at 13:28










  • First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
    – Raja Mohamed
    Nov 21 '18 at 13:30






  • 1




    Possible duplicate of Get difference between 2 dates in JavaScript?
    – adiga
    Nov 21 '18 at 13:37














-2












-2








-2







I have two timestamps and I need difference between them in hours. How to calculate them.






var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)












share|improve this question















I have two timestamps and I need difference between them in hours. How to calculate them.






var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)








var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)





var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = slaEndTime - slaStartTime
var resolutionTime = ((resolution / (1000 * 60)) % 60)






javascript angular






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 10:58

























asked Nov 21 '18 at 13:24









arun kumar

295




295












  • I'm assuming the sla prefix is an issue with copying your code to SO?
    – George
    Nov 21 '18 at 13:26






  • 1




    Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
    – Gerard
    Nov 21 '18 at 13:27






  • 1




    That's not a duplicate... the time here is not in 24 hour format
    – Oram
    Nov 21 '18 at 13:28










  • First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
    – Raja Mohamed
    Nov 21 '18 at 13:30






  • 1




    Possible duplicate of Get difference between 2 dates in JavaScript?
    – adiga
    Nov 21 '18 at 13:37


















  • I'm assuming the sla prefix is an issue with copying your code to SO?
    – George
    Nov 21 '18 at 13:26






  • 1




    Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
    – Gerard
    Nov 21 '18 at 13:27






  • 1




    That's not a duplicate... the time here is not in 24 hour format
    – Oram
    Nov 21 '18 at 13:28










  • First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
    – Raja Mohamed
    Nov 21 '18 at 13:30






  • 1




    Possible duplicate of Get difference between 2 dates in JavaScript?
    – adiga
    Nov 21 '18 at 13:37
















I'm assuming the sla prefix is an issue with copying your code to SO?
– George
Nov 21 '18 at 13:26




I'm assuming the sla prefix is an issue with copying your code to SO?
– George
Nov 21 '18 at 13:26




1




1




Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
– Gerard
Nov 21 '18 at 13:27




Possible duplicate of How can I calculate the difference between two times that are in 24 hour format?
– Gerard
Nov 21 '18 at 13:27




1




1




That's not a duplicate... the time here is not in 24 hour format
– Oram
Nov 21 '18 at 13:28




That's not a duplicate... the time here is not in 24 hour format
– Oram
Nov 21 '18 at 13:28












First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
– Raja Mohamed
Nov 21 '18 at 13:30




First convert both to same time format, may be to IST, then convert to milliseconds and find the difference
– Raja Mohamed
Nov 21 '18 at 13:30




1




1




Possible duplicate of Get difference between 2 dates in JavaScript?
– adiga
Nov 21 '18 at 13:37




Possible duplicate of Get difference between 2 dates in JavaScript?
– adiga
Nov 21 '18 at 13:37












5 Answers
5






active

oldest

votes


















1














You just need to divide rather than do times and modulus



/1000 will convert it to seconds



the first /60 will convert to minutes



and the last /60 hours






var resolution
var EndTime = 1541092163000
var StartTime = 1541077763000
resolution = EndTime - StartTime
var resolutionTime = (((resolution / 1000) / 60)/ 60)
console.log(resolutionTime)





Or you can use momentjs https://momentjs.com/






share|improve this answer





















  • its working @george
    – arun kumar
    Nov 22 '18 at 11:00



















0














See the snippet below.
You need to divide by 1000 then by 60 and then by 60 again to get the hours.
In short you need do divide by 1000*60*60=3600000.






var endTime = 1541092163000;
var startTime = 1541077763000;
var differenceInMiliseconds = endTime - startTime;
var differenceInSeconds = differenceInMiliseconds / 1000;
var differenceInMinutes = differenceInSeconds / 60;
var differenceInHours = differenceInMinutes / 60;
console.log(differenceInHours);

// or in short
console.log((endTime - startTime) / 3600000);








share|improve this answer





























    0














    have you tried to do this ?






    var resolution
    var EndTime = 1541092163000
    var StartTime = 1541077763000
    var resolution = EndTime - StartTime
    var resolutionTime = (parseFloat(resolution) / (60000*60) )
    console.log(resolutionTime)








    share|improve this answer





























      0














      Save yourself from manual dates manipulation insanity and use moment.js



      const moment = require('moment');

      var EndTime = 1541092163000
      var StartTime = 1541077763000
      var resolution = moment(EndTime - StartTime).asHours();





      share|improve this answer





















      • Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
        – Marv
        Nov 21 '18 at 13:43












      • Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
        – Anton Pastukhov
        Nov 21 '18 at 13:54



















      -1














      Use ms to calculate the difference between two timestamps






      const ms = require('ms');

      var EndTime = 1541092163000;
      var StartTime = 1541077763000;

      ms( EndTime - StartTime) //return 4h








      share|improve this answer





















      • Can you include what ms is?
        – George
        Nov 21 '18 at 13:35






      • 1




        How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
        – Maihan Nijat
        Nov 21 '18 at 13:35












      • ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
        – Ken Yip
        Nov 21 '18 at 13:38










      • The last comment should be inside the answer.
        – Oram
        Nov 21 '18 at 13:39











      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413034%2fhow-to-calculate-difference-between-two-timestamps-using-javascript%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You just need to divide rather than do times and modulus



      /1000 will convert it to seconds



      the first /60 will convert to minutes



      and the last /60 hours






      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)





      Or you can use momentjs https://momentjs.com/






      share|improve this answer





















      • its working @george
        – arun kumar
        Nov 22 '18 at 11:00
















      1














      You just need to divide rather than do times and modulus



      /1000 will convert it to seconds



      the first /60 will convert to minutes



      and the last /60 hours






      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)





      Or you can use momentjs https://momentjs.com/






      share|improve this answer





















      • its working @george
        – arun kumar
        Nov 22 '18 at 11:00














      1












      1








      1






      You just need to divide rather than do times and modulus



      /1000 will convert it to seconds



      the first /60 will convert to minutes



      and the last /60 hours






      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)





      Or you can use momentjs https://momentjs.com/






      share|improve this answer












      You just need to divide rather than do times and modulus



      /1000 will convert it to seconds



      the first /60 will convert to minutes



      and the last /60 hours






      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)





      Or you can use momentjs https://momentjs.com/






      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)





      var resolution
      var EndTime = 1541092163000
      var StartTime = 1541077763000
      resolution = EndTime - StartTime
      var resolutionTime = (((resolution / 1000) / 60)/ 60)
      console.log(resolutionTime)






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 21 '18 at 13:32









      George

      4,46711731




      4,46711731












      • its working @george
        – arun kumar
        Nov 22 '18 at 11:00


















      • its working @george
        – arun kumar
        Nov 22 '18 at 11:00
















      its working @george
      – arun kumar
      Nov 22 '18 at 11:00




      its working @george
      – arun kumar
      Nov 22 '18 at 11:00













      0














      See the snippet below.
      You need to divide by 1000 then by 60 and then by 60 again to get the hours.
      In short you need do divide by 1000*60*60=3600000.






      var endTime = 1541092163000;
      var startTime = 1541077763000;
      var differenceInMiliseconds = endTime - startTime;
      var differenceInSeconds = differenceInMiliseconds / 1000;
      var differenceInMinutes = differenceInSeconds / 60;
      var differenceInHours = differenceInMinutes / 60;
      console.log(differenceInHours);

      // or in short
      console.log((endTime - startTime) / 3600000);








      share|improve this answer


























        0














        See the snippet below.
        You need to divide by 1000 then by 60 and then by 60 again to get the hours.
        In short you need do divide by 1000*60*60=3600000.






        var endTime = 1541092163000;
        var startTime = 1541077763000;
        var differenceInMiliseconds = endTime - startTime;
        var differenceInSeconds = differenceInMiliseconds / 1000;
        var differenceInMinutes = differenceInSeconds / 60;
        var differenceInHours = differenceInMinutes / 60;
        console.log(differenceInHours);

        // or in short
        console.log((endTime - startTime) / 3600000);








        share|improve this answer
























          0












          0








          0






          See the snippet below.
          You need to divide by 1000 then by 60 and then by 60 again to get the hours.
          In short you need do divide by 1000*60*60=3600000.






          var endTime = 1541092163000;
          var startTime = 1541077763000;
          var differenceInMiliseconds = endTime - startTime;
          var differenceInSeconds = differenceInMiliseconds / 1000;
          var differenceInMinutes = differenceInSeconds / 60;
          var differenceInHours = differenceInMinutes / 60;
          console.log(differenceInHours);

          // or in short
          console.log((endTime - startTime) / 3600000);








          share|improve this answer












          See the snippet below.
          You need to divide by 1000 then by 60 and then by 60 again to get the hours.
          In short you need do divide by 1000*60*60=3600000.






          var endTime = 1541092163000;
          var startTime = 1541077763000;
          var differenceInMiliseconds = endTime - startTime;
          var differenceInSeconds = differenceInMiliseconds / 1000;
          var differenceInMinutes = differenceInSeconds / 60;
          var differenceInHours = differenceInMinutes / 60;
          console.log(differenceInHours);

          // or in short
          console.log((endTime - startTime) / 3600000);








          var endTime = 1541092163000;
          var startTime = 1541077763000;
          var differenceInMiliseconds = endTime - startTime;
          var differenceInSeconds = differenceInMiliseconds / 1000;
          var differenceInMinutes = differenceInSeconds / 60;
          var differenceInHours = differenceInMinutes / 60;
          console.log(differenceInHours);

          // or in short
          console.log((endTime - startTime) / 3600000);





          var endTime = 1541092163000;
          var startTime = 1541077763000;
          var differenceInMiliseconds = endTime - startTime;
          var differenceInSeconds = differenceInMiliseconds / 1000;
          var differenceInMinutes = differenceInSeconds / 60;
          var differenceInHours = differenceInMinutes / 60;
          console.log(differenceInHours);

          // or in short
          console.log((endTime - startTime) / 3600000);






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 13:36









          Oram

          658116




          658116























              0














              have you tried to do this ?






              var resolution
              var EndTime = 1541092163000
              var StartTime = 1541077763000
              var resolution = EndTime - StartTime
              var resolutionTime = (parseFloat(resolution) / (60000*60) )
              console.log(resolutionTime)








              share|improve this answer


























                0














                have you tried to do this ?






                var resolution
                var EndTime = 1541092163000
                var StartTime = 1541077763000
                var resolution = EndTime - StartTime
                var resolutionTime = (parseFloat(resolution) / (60000*60) )
                console.log(resolutionTime)








                share|improve this answer
























                  0












                  0








                  0






                  have you tried to do this ?






                  var resolution
                  var EndTime = 1541092163000
                  var StartTime = 1541077763000
                  var resolution = EndTime - StartTime
                  var resolutionTime = (parseFloat(resolution) / (60000*60) )
                  console.log(resolutionTime)








                  share|improve this answer












                  have you tried to do this ?






                  var resolution
                  var EndTime = 1541092163000
                  var StartTime = 1541077763000
                  var resolution = EndTime - StartTime
                  var resolutionTime = (parseFloat(resolution) / (60000*60) )
                  console.log(resolutionTime)








                  var resolution
                  var EndTime = 1541092163000
                  var StartTime = 1541077763000
                  var resolution = EndTime - StartTime
                  var resolutionTime = (parseFloat(resolution) / (60000*60) )
                  console.log(resolutionTime)





                  var resolution
                  var EndTime = 1541092163000
                  var StartTime = 1541077763000
                  var resolution = EndTime - StartTime
                  var resolutionTime = (parseFloat(resolution) / (60000*60) )
                  console.log(resolutionTime)






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 21 '18 at 13:40









                  David Marabottini

                  1707




                  1707























                      0














                      Save yourself from manual dates manipulation insanity and use moment.js



                      const moment = require('moment');

                      var EndTime = 1541092163000
                      var StartTime = 1541077763000
                      var resolution = moment(EndTime - StartTime).asHours();





                      share|improve this answer





















                      • Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                        – Marv
                        Nov 21 '18 at 13:43












                      • Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                        – Anton Pastukhov
                        Nov 21 '18 at 13:54
















                      0














                      Save yourself from manual dates manipulation insanity and use moment.js



                      const moment = require('moment');

                      var EndTime = 1541092163000
                      var StartTime = 1541077763000
                      var resolution = moment(EndTime - StartTime).asHours();





                      share|improve this answer





















                      • Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                        – Marv
                        Nov 21 '18 at 13:43












                      • Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                        – Anton Pastukhov
                        Nov 21 '18 at 13:54














                      0












                      0








                      0






                      Save yourself from manual dates manipulation insanity and use moment.js



                      const moment = require('moment');

                      var EndTime = 1541092163000
                      var StartTime = 1541077763000
                      var resolution = moment(EndTime - StartTime).asHours();





                      share|improve this answer












                      Save yourself from manual dates manipulation insanity and use moment.js



                      const moment = require('moment');

                      var EndTime = 1541092163000
                      var StartTime = 1541077763000
                      var resolution = moment(EndTime - StartTime).asHours();






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 21 '18 at 13:41









                      Anton Pastukhov

                      1978




                      1978












                      • Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                        – Marv
                        Nov 21 '18 at 13:43












                      • Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                        – Anton Pastukhov
                        Nov 21 '18 at 13:54


















                      • Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                        – Marv
                        Nov 21 '18 at 13:43












                      • Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                        – Anton Pastukhov
                        Nov 21 '18 at 13:54
















                      Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                      – Marv
                      Nov 21 '18 at 13:43






                      Sure, add a 50 kB library to substract two numbers from each other. Might be a bit of an overkill
                      – Marv
                      Nov 21 '18 at 13:43














                      Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                      – Anton Pastukhov
                      Nov 21 '18 at 13:54




                      Sure it is the right way! Initially I wanted to suggest jQuery because of i.stack.imgur.com/ssRUr.gif, but then realized it's kinda felt out of fashion
                      – Anton Pastukhov
                      Nov 21 '18 at 13:54











                      -1














                      Use ms to calculate the difference between two timestamps






                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h








                      share|improve this answer





















                      • Can you include what ms is?
                        – George
                        Nov 21 '18 at 13:35






                      • 1




                        How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                        – Maihan Nijat
                        Nov 21 '18 at 13:35












                      • ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                        – Ken Yip
                        Nov 21 '18 at 13:38










                      • The last comment should be inside the answer.
                        – Oram
                        Nov 21 '18 at 13:39
















                      -1














                      Use ms to calculate the difference between two timestamps






                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h








                      share|improve this answer





















                      • Can you include what ms is?
                        – George
                        Nov 21 '18 at 13:35






                      • 1




                        How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                        – Maihan Nijat
                        Nov 21 '18 at 13:35












                      • ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                        – Ken Yip
                        Nov 21 '18 at 13:38










                      • The last comment should be inside the answer.
                        – Oram
                        Nov 21 '18 at 13:39














                      -1












                      -1








                      -1






                      Use ms to calculate the difference between two timestamps






                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h








                      share|improve this answer












                      Use ms to calculate the difference between two timestamps






                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h








                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h





                      const ms = require('ms');

                      var EndTime = 1541092163000;
                      var StartTime = 1541077763000;

                      ms( EndTime - StartTime) //return 4h






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 21 '18 at 13:34









                      Ken Yip

                      11




                      11












                      • Can you include what ms is?
                        – George
                        Nov 21 '18 at 13:35






                      • 1




                        How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                        – Maihan Nijat
                        Nov 21 '18 at 13:35












                      • ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                        – Ken Yip
                        Nov 21 '18 at 13:38










                      • The last comment should be inside the answer.
                        – Oram
                        Nov 21 '18 at 13:39


















                      • Can you include what ms is?
                        – George
                        Nov 21 '18 at 13:35






                      • 1




                        How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                        – Maihan Nijat
                        Nov 21 '18 at 13:35












                      • ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                        – Ken Yip
                        Nov 21 '18 at 13:38










                      • The last comment should be inside the answer.
                        – Oram
                        Nov 21 '18 at 13:39
















                      Can you include what ms is?
                      – George
                      Nov 21 '18 at 13:35




                      Can you include what ms is?
                      – George
                      Nov 21 '18 at 13:35




                      1




                      1




                      How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                      – Maihan Nijat
                      Nov 21 '18 at 13:35






                      How this will help? No explanation and what is ms? This could be easily achieved by simple JS. No need for third party package. George provided solution for it.
                      – Maihan Nijat
                      Nov 21 '18 at 13:35














                      ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                      – Ken Yip
                      Nov 21 '18 at 13:38




                      ms is a popular NodeJs framework that transform between various time formats and milliseconds. npmjs.com/package/ms
                      – Ken Yip
                      Nov 21 '18 at 13:38












                      The last comment should be inside the answer.
                      – Oram
                      Nov 21 '18 at 13:39




                      The last comment should be inside the answer.
                      – Oram
                      Nov 21 '18 at 13:39


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413034%2fhow-to-calculate-difference-between-two-timestamps-using-javascript%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Wiesbaden

                      Marschland

                      Dieringhausen