简体   繁体   中英

Time Updating issue in javascript

In javascript there is object new Date() it gives current time and date that may be picked by system clock

But when i move time next hours why it should take approx 45 seconds to update time in javascript?

Example:- current time is 10:46 but when I change my system clock to 11:46 it will take approx 45 seconds to update.

Try this its working for me:

var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
console.log(time);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM