how to check time is 24 hour or 12 hours in javascript code example
Example 1: javascript get 24 hour time
var options = { hour12: false };
console.log(date.toLocaleString('en-US', options));
Example 2: javascript calculate 24 hours ago
var ts = Math.round(new Date().getTime() / 1000);
var tsYesterday = ts - (24 * 3600);