Terry's blog

Focus on bigdata and cloud.

博客园 首页 新随笔 联系 订阅 管理

概述:

     年月日都是用全中文显示

代码:          

<script language="JavaScript">
<!--
function number(index1){
var numberstring="一二三四五六七八九十";
if(index1 ==0) {document.write("")}
if(index1 < 10){
document.write(numberstring.substring(
0+(index1-1),index1))}
else if(index1 < 20 ){
document.write(
""+numberstring.substring(0+(index1-11),(index1-10)))}
else if(index1 < 30 ){
document.write(
"二十"+numberstring.substring(0+(index1-21),(index1-20)))}
else{
document.write(
"三十"+numberstring.substring(0+(index1-31),(index1-30)))}
}

var today1 = new Date()
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()

document.write(
"公元二零零三年")
number(month)
document.write(
"")
number(date)
document.write(
"")
//-->
</script>
   

 

结果:

     公元二零零三年九月二十四日

posted on 2008-09-24 16:42  王晓成  阅读(292)  评论(0编辑  收藏  举报