JavaScript(data对象)

var mDate = new Date();
var Y = mDate.getFullYear();
var Mo = mDate.getMonth()+1;
/*获取的月份是从零开始算即当前月份减1*/
var D = mDate.getDate();/*日*/
var H = mDate.getHours();/*时*/
var Mi = mDate.getMinutes();/*分*/
var S = mDate.getSeconds();/*秒*/
alert("当前时间是:"+Y+'年'+Mo+'月'+D+'日'+H+'时'+Mi+'分'+S+'秒');



feihu分享到:

          

You may also like...

Scroll Up