Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在 JavaScript 中获取当前日期
我如何使用 javascript 从浏览器中抽出时间?我需要在我的脚本中进行比较。
currentTime = new Date(); time = currentTime.getTime(); hours = currentTime.getHours();
ETC
您可以使用Date 对象来获取当前时间:
var currentTime = new Date();