Skip to content
New issue

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

时间计算错误你们有遇到么? #5

Open
Zenuncl opened this issue Mar 18, 2014 · 5 comments
Open

时间计算错误你们有遇到么? #5

Zenuncl opened this issue Mar 18, 2014 · 5 comments

Comments

@Zenuncl
Copy link

Zenuncl commented Mar 18, 2014

比如我用这个代码计算了一个2013年10月30日到现在(14年3月18日)的时间,明明是139天但是却显示在网站上是108天,是我使用错误还是什么错误??

@chenkan0104
Copy link

我觉得你得注意一下javascript的时间set函数,看看参数是从零开始还是从1开始,挺坑人的。

发件人: David Jiang [mailto:notifications@github.com]
发送时间: 2014年3月18日 13:39
收件人: hackerzhou/Love
主题: [Love] 时间计算错误你们有遇到么? (#5)

比如我用这个代码计算了一个2013年10月30日到现在(14年3月18日)的时间,明明是139天但是却显示在网站上是108天,是我使用错误还是什么错误??


Reply to this email directly or view it on GitHub #5 . https://github.com/notifications/beacon/3645791__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMDc0MDMxNiwiZGF0YSI6eyJpZCI6Mjc5MTIzODR9fQ==--a0f4efb62c3dd205a21d4d2d17cb356384f5d62c.gif

@drjinying
Copy link

我也遇到了这个问题,但是变换一下表达就对了,原本为什么错,我也搞不清楚。
我commit的上面有这部分代码。我是按天计算的,可供参考。

@hackerzhou
Copy link
Owner

看来你们都不知道javascript的date是从0-11的。。。

@drjinying
Copy link

== 我去...服了,看来我的程序员思维还不够深入啊!

@wenge9487
Copy link

对 会差一个月,因为是从0开始算的= =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants