读书人

Date()のメソッド14桁日付の获

发布时间: 2012-11-10 10:48:50 作者: rapoo

Date()のメソッド——14桁日付の取得方法
参照ドキュメント:http://www.w3school.com.cn/js/jsref_obj_date.asp

function getSysTimestamp() {    var now = new Date();    var date=now.getDate();    var month=now.getMonth()+1;    var year=now.getYear();    var timestr;    timestr = year;    timestr += ((month<10)?"0":"")+month;    timestr += ((date<10)?"0":"")+date;    var hours = now.getHours();    var minutes = now.getMinutes();    var seconds = now.getSeconds();    var milseconds = now.getMilliseconds();    timestr += ((hours<10)?"0":"")+hours;    timestr += ((minutes<10)?"0":"")+minutes;    timestr += ((seconds<10)?"0":"")+seconds;    timestr += milseconds;    return timestr;}

读书人网 >Web前端

热点推荐