mkr*_*use 22
浏览器实际上并没有"有时间",它从系统时钟中获取时间.当然,如果你想做一些特别讨厌的事情,你可以覆盖Date函数.
Date.prototype.getTime = function() { return 1 };
(new Date).getTime(); // 1
Run Code Online (Sandbox Code Playgroud)
因此,如果您想将时间设置为1989年11月4日凌晨1点,您首先要找到时间值:
(new Date('1989-11-04T01:00:00')).getTime() // Returns 626144400000
Run Code Online (Sandbox Code Playgroud)
然后在浏览器中模拟它:
Date.prototype.getTime = function() { return 626144400000 };
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19447 次 |
最近记录: |