How to get Current Store DateTime in Javascript magento2. Is any library function available?
1 Answer
You can use in you js file in Magento 2
var timestamp = new Date().getTime();
var hours = Math.floor((timestamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((timestamp % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((timestamp % (1000 * 60)) / 1000);
console.log('Time');
console.log(hours + ":" + minutes + ":" + seconds);