I want to calculate date difference in days, hours, minutes, seconds, milliseconds, nanoseconds. How can I do it?
If you are using moment.js then it is pretty simple to find date difference.
var now = "04/09/2013 15:00:00"; var then = "04/09/2013 14:20:30"; moment.utc(moment(now,"DD/MM/YYYY HH:mm:ss").diff(moment(then,"DD/MM/YYYY HH:mm:ss"))).format("HH:mm:ss")