js获取系统当前时间
2009-11-09 22:38
274 查看
<script language="JavaScript"><!-- //日期 var now = new Date(); //获取系统日期,即Sat Jul 29 08:24:48 UTC+0800 2006 var yy = now.getYear(); //截取年,即2006 var mm = now.getMonth(); //截取月,即07 var dd = now.getDate(); //截取日,即29 //取时间 var hh = now.getHours(); //截取小时,即8 var mm = now.getMinutes(); //截取分钟,即34 var ss = now.getTime() % 60000; //获取时间,因为系统中时间是以毫秒计算的, 所以秒要通过余60000得到。 ss = (ss - (ss % 1000)) / 1000; //然后,将得到的毫秒数再处理成秒 var clock = hh+':'; //将得到的各个部分连接成一个日期时间 if (mm < 10) clock += '0'; //字符串 clock += mm+':'; if (ss < 10) clock += '0'; clock += ss; // --></script>
相关文章推荐
- JS之Date对象和获取系统当前时间
- 使用js获取系统当前时间并在页面显示
- js获取系统当前时间
- js获取当前系统时间
- jquery获取当前系统时间+js两个时间的大小比较
- 原生JS获取系统当前日期和时间
- js 获取系统当前时间
- js+html获取系统当前时间
- js获取当前系统时间 && js获取当前系统时间-24小时 && 当前系统时间+24小时
- 30、JS如何获取当前系统时间?
- JS 获取当前系统时间
- js获取当前系统时间
- JS之Date对象和获取系统当前时间详解
- js 获取系统当前时间
- js获取当前系统时间后台转化为long型
- js动态获取当前系统时间+js字符串转换为date日期对象
- Js获取当前系统时间
- js获取当前系统时间
- js实时获取系统当前时间实例代码
- js实时获取系统当前时间实例代码