0

How to get Current Store DateTime in Javascript magento2. Is any library function available?

1 Answer 1

0

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.