js的样式代码,以指定的格式显示日期和时间。

{备注:对于外部JS的引入,需要执行刷新}
时间就是现在的时间。
复制代码代码如下所示:
/ / 1.2013-4-9 11:21:32
/ / 2.2013、4月9日,11:21 32秒
/ / 3.2013、4月9日,在21点,32秒
/ / 4.2013、4月9日,在21点,32秒
*
VaR theDate =新的日期();
警报(日期。返回完整年份)-(+)thedate.getmonth(+)- thedate.getdate(+ +)'(日期。tolocaletimestring);
警报(thedate.tolocaledatestring()+ + + thedate.gethours()+点+ thedate.getminutes()+ + + thedate.getseconds()+秒);
如果(thedate.gethours()<12){
警报(thedate.tolocaledatestring()+是+ thedate.gethours()+点+ thedate.getminutes()+ + + thedate.getseconds()+秒);
}
{其他
警报(thedate.tolocaledatestring()+点+ thedate.gethours()+点+ thedate.getminutes()+ + + thedate.getseconds()+秒);
}
* /