我有一个脚本,打印当前的日期和时间在JavaScript,但DATE
总是错误的。代码如下:
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDay() + "/" + currentdate.getMonth()
+ "/" + currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":" + currentdate.getSeconds();
它应该打印18/04/2012 15:07:33
和3/3/2012 15:07:33