英文时间代码

英文时间代码

 

代码
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
dayName
= new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
monName
= new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
now
= new Date
// End -->
</script>
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var strDay;
if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1)) // Correction for 11th and 1st/21st/31st
strDay = "st ";
else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd
strDay = "nd ";
else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) // Correction for 13th and 3rd/23rd/33rd
strDay = "rd ";
else
strDay
= "th ";
document.write(
dayName[now.getDay()]
+
" the "
+
now.getDate()
+
strDay
+
"of "
+
monName[now.getMonth()]
+
", "
+
now.getFullYear()
)
// End -->
</script>

 

 

有具体时刻的:

 

<span id="date" style="font-size:12px;color:#ff0200"></span>
<SCRIPT LANGUAGE="JavaScript">
function getDATE(){
    var o=document.getElementById("date");
   
    var dayName = new Array("", "mon", "tue", "wed", "thu", "fri", "sat", "sun");
    var monName = new Array("Jan. ", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Ang.", "Sep.", "Oct.", "Nov.", "Dec.");
    var now = new Date();
   
    var strDay;
    if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1))   // Correction for 11th and 1st/21st/31st
    strDay = "st ";
    else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd
    strDay = "nd ";
    else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) // Correction for 13th and 3rd/23rd/33rd
    strDay = "rd ";
    else
    strDay = "th ";
   
    var str=dayName[now.getDay()]    +    " the "    +    now.getDate()+    strDay    +    "of "    +    monName[now.getMonth()]+' '+    now.getFullYear()    +' '+    now.getHours()    +':'+    now.getMinutes()    +':'+    now.getSeconds();
   
    o.innerHTML=str;
   }
    getDATE()
window.setInterval(getDATE,1000)
</script>

 

 

 

posted on 2010-03-30 14:28  wind side  阅读(1623)  评论(0编辑  收藏  举报

导航