用C#就这么简单,看来输出时间用js不太好。
DateTime.Now.ToShortDateString();//输出2009-7-7
DateTime.Now.ToString("yyyy年MM月dd日");
DateTime.Now.ToString(
"D");
javascript居然这么大一堆。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    
<title>javascript输出时间格式:2009年7月7日</title>
    
<script type="text/javascript">    
      
function PageDate(){   
          currentDate 
= new Date()   
          
with(currentDate){   
              day
=getDay()   
              month
=getMonth()+1   
              
this.document.classname="sj"   
              
this.document.write('北京时间   '+getFullYear()+''+month+''+getDate()+'')   
          }   
          
if   (day==1){document.write('   星期一')}   
          
if   (day==2){document.write('   星期二')}   
          
if   (day==3){document.write('   星期三')}   
          
if   (day==4){document.write('   星期四')}   
          
if   (day==5){document.write('   星期五')}   
          
if   (day==6){document.write('   星期六')}   
          
if   (day==0){document.write('   星期日')}   
          
//document.write('<br/>')   
      }   
    
</script>
</head>
<body>
    
<table>
        
<tr>
            
<td>现在时间:</td>
            
<td><script type="text/javascript">PageDate();</script></td>
        
</tr>
    
</table>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
  • 2021-06-06
  • 2021-11-02
  • 2021-06-03
  • 2021-10-28
  • 2022-01-31
猜你喜欢
  • 2021-06-04
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-12-24
  • 2021-05-26
  • 2021-09-10
相关资源
相似解决方案