js时间格式化成字符串我⽤的简单的直接的字符串格式转化
function getTimeStr() {
var date = new Date();
var year = FullYear();
var month = Month() + 1;
var day = Date();
var hours = Hours();
var minutes = Minutes();
if (month.length == 1) {
month = "0" + month;
}
if (day.length == 1) {
day = "0" + day;
}
日期转字符串函数if (hours.length == 1) {
hours = "0" + hours;
}
if (minutes.length == 1) {
minutes = "0" + minutes;
}
var d = year + "-" + month + "-" + day + " " + hours + ":" + minutes;
return d;
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论