JavaScirpt
從Date類型中取形如 20091201 字符串
function getDate(s_date) {
var str_date = new Array();
str_date.push(s_date.getFullYear());
str_date.push(s_date.getMonth() < 9 ? "0" + (s_date.getMonth() + 1)
: (s_date.getMonth() + 1));
str_date.push(s_date.getDate() < 10 ? "0" + s_date.getDate() : s_date
.getDate());
return str_date.join("");
}
var str_date = new Array();
str_date.push(s_date.getFullYear());
str_date.push(s_date.getMonth() < 9 ? "0" + (s_date.getMonth() + 1)
: (s_date.getMonth() + 1));
str_date.push(s_date.getDate() < 10 ? "0" + s_date.getDate() : s_date
.getDate());
return str_date.join("");
}
posted on 2009-12-31 14:11 至尊貝貝 閱讀(132) 評論(0) 編輯 收藏 所屬分類: 代碼:JavaScript