各种中英文时间代码

<script LANGUAGE="javascript">
<!---------- javascript begins...
var hours;
var minutes;
var seconds;
var CurrentTime;
function update () {
time = new Date ();
hours = time.getHours ();
minutes = time.getMinutes ();
seconds = time.getSeconds ();
if (hours < 10) {
CurrentTime = "0" + hours;
} else {
CurrentTime = hours;
}
if (minutes < 10) {
CurrentTime += (":0" + minutes);
} else {
CurrentTime += (":" + minutes);
}
if (seconds < 10) {
CurrentTime += (":0" + seconds);
} else {
CurrentTime += (":" + seconds);
}
if (document.clock.time.value != CurrentTime) {
document.clock.time.value = CurrentTime;
}
updt = window.setTimeout ("update ()",100);
}
// javascript ends ---------->
</script>
<form name="clock">
<input type="text" name="time" size=8>
<script LANGUAGE="javascript">
<!--
update ();
// --></script>
</form>
<br>


<script LANGUAGE="javascript">
<!--
var date=new Date()
var year=date.getYear()
var month=date.getMonth()+1
var day=date.getDate()
if (year < 1000)
year+=1900
if (month<10)
month="0"+month
if (day<10)
day="0"+day
document.write(year+"/"+month+"/"+day)
// -->
</script>
<br>


<script LANGUAGE="javascript">
<!--
today=new Date()
var date=new Date()
var year=date.getYear()
var month=date.getMonth()+1
var day=date.getDate()
var d=new initArray("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
if (year < 1000)
year+=1900;
if (month<10)
month="0"+month
if (day<10)
day="0"+day
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
document.write(d[today.getDay()+1]," ",year,"/",month,"/",day)
// -->
</script>
<br>


<!---Date---->
<script language=javascript>
<!--
today=new Date();
var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
document.write("<font color=brown style='font-family: verdana, tahoma, arial, helvetica; font-size: 9pt;'>",d[today.getDay()+1]," ",today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日","</font>");
// -->
</script>
<!---Date---->
<br>


<!---En Date---->
<script language=javascript>
<!--
today=new Date();
var d=new initArray("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var m=new initArray("Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec.");
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
document.write("<font color=brown style='font-family: verdana, tahoma, arial, helvetica; font-size: 9pt;'>",d[today.getDay()+1],"."," ",m[today.getMonth()+1]," ",today.getDate(),","," ",today.getYear(),"</font>");
// -->
</script>
<!---En Date---->
<br>


<!---En Full Date---->
<script language=javascript>
<!--
today=new Date();
var week=new initArray("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var month=new initArray("January","February","March","April","May","June","July","August","September","October","November","December");
var day=new initArray("1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","rd","24th","25th","26th","27th","28th","29th","30th","31st");
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
document.write("<font color=brown style='font-family: verdana, tahoma, arial, helvetica; font-size: 9pt;'>",week[today.getDay()+1],","," ",month[today.getMonth()+1]," ",day[today.getDate()],","," ",today.getYear(),"</font>");
// -->
</script>
<!---En Full Date---->

代码显示样式:

2006/03/08
--------------------
Wed 2006/03/08
----------------------
星期三 2006年3月8日
---------------------------
Wed. Mar. 8, 2006
-------------------------------
Wednesday, March 8th, 2006


引用通告: 查看所有引用 | 我要引用此文章
Tags: 各种中英文时间代码
收藏到网摘:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.