js提取某年某月某日星期几

需要注意的点:

  1. getMonth()返回月份0-11,0对应1月
  2. getDay()返回天数0-6,0对应星期日
  3. if (document.all)判断当前浏览器是否为IE
//显示当前时间
function ndate()
{
	var isnMonth = new Array("1月","2月","3月","4月","5月",
					"6月","7月","8月","9月","10月","11月","12月");
	var isnDay = new Array("星期日","星期一","星期二",
					"星期三","星期四","星期五","星期六");
	today = new Date () ;
	Year=today.getYear();
	Date=today.getDate();
	if (document.all)//判断当前浏览器是否为 ie
	document.write("  "+Year+"年"
					+isnMonth[today.getMonth()]+Date+"日"
					+isnDay[today.getDay()]);					
					
}


 

 

你可能感兴趣的:(js)