| 项目搜索 |
| |
|
代码片段库:
查看代码片段
浏览
| 提交新的代码片段
| 创建代码包
英文的特殊时间显示
|
类型:
Full Script |
类别:
HTML Manipulation
|
许可证:
GNU General Public License |
语言:
JavaScript
|
描述:
一段标准的英文时间显示,可以显示如1st,2nd,3rd等特殊日期
|
该代码片段的版本系列:
片段ID |
下载版本 |
提交时间 |
提交人 |
删除 |
4686 | 1.0 | 2003-10-14 14:41 | cbd001 | |
点击"下载版本"来下载该代码片段.
最新版本的代码片段: 1.0
脚本说明:
<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>
如果您修改了一个代码片段并且觉得很应该让别人共享,您可以把这作为这个代码片段的最新版本提交上来. |
|