JS时间,中英文2个版本

中文

<SCRIPT>
setInterval("document.getElementById('nav_sj').innerHTML=new Date().toLocaleString()+' '+''.charAt(new Date().getDay());",1000);
              </SCRIPT>



英文

<script language="JavaScript" type="text/javascript"> 
<!-- 
calendar = new Date();  //得到当前日期
day = calendar.getDay();  //当前多数号
month = calendar.getMonth(); //当前月份
date = calendar.getDate();  //当前星期
year = calendar.getYear();  //年份
if (year< 100) year = 1900 + year; 
cent = parseInt(year/100); 
g = year % 19; 
k = parseInt((cent - 17)/25); 
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30; 
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11)); 
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7; 
l = i - j; 
emonth = 3 + parseInt((l + 40)/44); 
edate = l + 28 - 31*parseInt((emonth/4)); 
emonth--; 
var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); 
var monthname = 
new Array ("January","February","March","April","May","June","July","August","September","October","November","December" ); 
document.write(2013 +","); 
document.write(monthname[month]); 
document.write(date + ""+", "); 
document.write(dayname[day]); 
//--> 
</script>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值