Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

moment js date diff

var now  = "04/09/2013 15:00:00";
var then = "02/09/2013 14:20:30";

var ms = moment(now,"DD/MM/YYYY HH:mm:ss").diff(moment(then,"DD/MM/YYYY HH:mm:ss"));
var d = moment.duration(ms);
var s = d.format("hh:mm:ss");

// outputs: "48:39:30"
Comment

moment diff

const dateDifference = moment(date1).diff(moment(date2))
Comment

moment diff

var a = moment([2007, 0, 29]);
var b = moment([2007, 0, 28]);
a.diff(b, 'days') // 1
Comment

PREVIOUS NEXT
Code Example
Javascript :: external script in react 
Javascript :: some method in js 
Javascript :: print first n prime numbers in javascript 
Javascript :: js spleep 
Javascript :: using underscore javascript number 
Javascript :: react native navigation shared element 
Javascript :: override important css 
Javascript :: Material-UI: A component is changing the default value state of an uncontrolled Select after being initialized. To suppress this warning opt to use a controlled Select. 
Javascript :: placeholder text disappear when click in react 
Javascript :: datatables cdn 
Javascript :: string splice javascript 
Javascript :: google gapi auth2 get current token 
Javascript :: capitalize mdn 
Javascript :: checkbox event listeners 
Javascript :: webpack babel loaders/plugin installation 
Javascript :: js while continue 
Javascript :: javascript check undefined 
Javascript :: generate random number js 
Javascript :: electron get printer list 
Javascript :: chrome storage local example 
Javascript :: javascript between 
Javascript :: event loop in javascript 
Javascript :: nested function javascript 
Javascript :: axios get request javascript stackoverflow 
Javascript :: learn nestjs 
Javascript :: how to setup icomoon in react js 
Javascript :: js binary 
Javascript :: nuxt vuetify google fonts 
Javascript :: get element by class name 
Javascript :: selector jquery 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =