We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ECMAScript 5规范在09年正式发布了,随着智能手机的普及和浏览器厂商的支持,无线前端开发者们也终于可以放心的在项目中实际使用了。本文是ECMA5系列介绍的一篇,主要讲解的是关于Date相关的API。
var dt = new Date("30 July 2010 15:05 UTC"); console.log(dt.toISOString()); // Output: // 2010-07-30T15:05:00.000Z
console.log(Date.now()) // 1420015125590
过去我们通常是使用这样的方法来获取时间戳:
console.log(+new Date()) // 1420015125590 console.log( (Date.now() === +new Date()) ) // true
现在有了标准方法是不是变得很开心了呢
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ECMA5规范对Date对象新增了两个方法,分别是Date.prototype.toISOString和Date.now
objDate.toISOString()
描述:以字符串值的形式返回采用 ISO 格式的日期。
示例
Date.now()
描述:获取当前日期和时间。
返回值:1970 年 1 月 1日午夜与当前日期和时间之间的毫秒数。
示例:
过去我们通常是使用这样的方法来获取时间戳:
现在有了标准方法是不是变得很开心了呢
如果有任何问题都可以在下方给予我留言~
The text was updated successfully, but these errors were encountered: