记录一个笨拙而简单的拼接时间字符串的方法:
function GetCurrentTimeStr() { var currentDate = new Date(); var currentTimeStr = null; var year = currentDate.getFullYear().toString(); var month = (currentDate.getMonth() + 1).toString(); var date = currentDate.getDate().toString(); var hour = currentDate.getHours().toString(); var minute = currentDate.getMinutes().toString(); var second = currentDate.getSeconds().toString(); currentTimeStr = second + minute + hour + date + month + year; return currentTimeStr; }
基本的数据获取到了,想要什么格式的那就自己进行组装吧。。。。。
更多内容请看如下这篇文章: http://www.cnblogs.com/mingmingruyuedlut/archive/2011/10/12/2208564.html