js 写日期

<SCRIPT language="JavaScript" type="text/JavaScript">
  today = new Date();
  var day=""
  var date1=""
  if(today.getDay()==0) day = "星期日"
  else if(today.getDay()==1) day = "星期一"
  else if(today.getDay()==2) day = "星期二"
  else if(today.getDay()==3) day = "星期三"
  else if(today.getDay()==4) day = "星期四"
  else if(today.getDay()==5) day = "星期五"
  else if(today.getDay()==6) day = "星期六";
  if (today.getYear()>=2000)
  date1 = (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 ";
  else
  date1 = (1900 + today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 ";
  document.writeln(date1+day)
  </SCRIPT>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。