用getSeconds()可以得到当前秒数
看到一个用getTime()得到的:
var now = new Date();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
document.write(ss);
不大理解,请教一下
看到一个用getTime()得到的:
var now = new Date();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
document.write(ss);
不大理解,请教一下
解决方案 »
- js全部替换方法替换中括号的问题
- document.body.clientWidth document.body.offsetWidth 和 document.body.scrollHeight
- 动态添加控件后怎么添加不上事件
- 这段代码无法弹出,请问怎么回事,谢谢,抱歉每份了
- 如何判断选择哪一个?
- 问一下jquery问题!有经验的来
- 简单图层问题?(怎么让图层处于所有图层最上层!)
- JavaScript 访问 外部 XML
- 我希望用web页的方式实现客户端的套打、与串口通讯(如IC卡设备)等功能
- 怎么样才能得到上一页的文件名啊?
- 菜鸟问题,超级链接 onclick如何在一个窗口中打开新页面
- 关于页面速度
var ss = now.getTime() % 60000; //得到now里的时间,%6000这个得到毫秒数。
ss = (ss - (ss % 1000)) / 1000; //毫秒除1000得秒。
document.write(ss); //这个知道吧??
如:
<script type="text/javascript">var Birthday = new Date("July 21, 1983 01:15:00")
document.write(Birthday.getSeconds())</script>
返回值是:0
有什么问题么?
getTime( ) converts a date and time to a single integer. Date.getMilliseconds( ): return the milliseconds field of a Date