我在javascript中使用日期,这是我的代码
var CurrentDate = new Date();
document.write("current date = " + CurrentDate); // Using new Date(), creates a new date object with the current date and time:
document.write("<br>")
document.write("<br>")
//Using new Date(date string), creates a new date object from the specified date and time:
var d = new Date("October 13, 2014 11:13:00");
document.write("Specific date using overload constructor od Date(date string) = " + d);
document.write("<br>");
document.write("<br>");
/*Using new Date(7 numbers), creates a new date object with the specified date and time:
The 7 numbers specify the year, month, day, hour, minute, second, and millisecond, in that order: */
var a = new Date(99, 5, 24, 11, 33, 30, 0);
document.write("Specific date using overload constructor od Date(7 numbers) = " + a);
document.write("<br>");
document.write("<br>");
我在这里发现了类似的问题,但没有一个能解决我的问题?任何人都有这个想法吗?
答案 0 :(得分:0)
new Date()
返回当前时间,而不是当前日期。
使用:
new Date().format('m-d-Y h:i:s');
新日期();