求一段显示当前日期的JS代码 格式:13-MAR 代表:三月13日。
发布网友
发布时间:2024-05-21 01:42
我来回答
共1个回答
热心网友
时间:2024-05-25 21:03
<html>
<head>
<title>insert title here</title>
<script type="text/javaScript">
var d = new Date();
var s = d.getDate() + "-";
switch (d.getMonth())
{
case 0:
s += "JAN";
break;
case 1:
s += "FEB";
break;
case 2:
s += "MAR";
break;
case 3:
s += "APR";
break;
case 4:
s += "MAY";
break;
case 5:
s += "JUN";
break;
case 6:
s += "JUL";
break;
case 7:
s += "AUG";
break;
case 8:
s += "SEP";
break;
case 9:
s += "OCT";
break;
case 10:
s += "NOV";
break;
case 11:
s += "DEC";
break;
}
document.write(s);
</script>
</head>
<body>
</body>
</html>