I have two UTC strings, and I want to calculate their difference using javascript.
const stored = "2021-09-21T06:49:15.574Z"
const now = "2021-09-21T07:49:15.574Z"
I want the output to be in minutes.
Thanks in advance.
Please view https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date for more on how to use dates.
// from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
// Using Date objects
let start = Date.now() - 3.6e+6;
// The event to time goes here:
let end = Date.now();
let elapsed = end - start; // elapsed time in milliseconds
let minutes = Math.floor(elapsed / 60000);
console.log(minutes);