日期与时间:
new Date().toLocaleString() 2021/3/8 下午6:41:02
new Date().toLocaleDateString() 2021/3/8
new Date().toLocaleTimeString() 下午6:43:16
或者
var currentdate = new Date();
var datetime = currentdate.getFullYear() + "-" + (currentdate.getMonth() + 1) + "-" + currentdate.getDate() + " "
- currentdate.getHours() + ":"
- currentdate.getMinutes() + ":"
- currentdate.getSeconds() + "";