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

如何表达时间? (Unix Timestamp) #8

nonocast opened this issue Mar 2, 2020 · 0 comments

如何表达时间? (Unix Timestamp) #8

nonocast opened this issue Mar 2, 2020 · 0 comments


Copy link

@nonocast nonocast commented Mar 2, 2020

The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC.

unix time stamp 是数字,时区无关,建议全程在系统内部,包括接口也应该采用unix time stamp,只有在需要人机交互时采用UTC或GMT来做format。


  1. 2^32最多上限只能到2038/1/19, 超过以后overflow,时间回到1970/1/1,所以最好用2^64存储
  2. 如果时间精度需要上升为毫秒(ms)时,就是增加10^3


  • unix timestamp: 表示秒
  • unix ms timestamp: 表示毫秒



  • moment().unix() => unix timestamp
  • moment().valueOf() => unix ms timestamp


  • moment(unix ms timestamp)
  • moment.unix(unix timestamp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.