js 获取当前时间

Date.prototype.showChineseStyle = function(){
	var date = this;
	var dstr = date.getFullYear() + "年" + (date.getMonth() + 1) + "月"
			+ date.getDate() + "日";
	dstr += " "
			+ date.getHours()
			+ ":"
			+ (date.getMinutes() < 10 ? "0" + date.getMinutes() : date
					.getMinutes())
			+ ":"
			+ (date.getSeconds() < 10 ? "0" + date.getSeconds() : date
					.getSeconds());
	
	       return dstr;
	}
var date = new Date();
alert(date.showTime());

猜你喜欢

转载自blog.csdn.net/banpu/article/details/78991659