Getting current unixtimestamp using Moment.js

前端 未结 4 1692
温柔的废话
温柔的废话 2021-01-30 05:57

I want to get the Unix TimeStamp using Moment.js. I can find many functions which convert timestamp to date in moment.js. I know that I can easily get the unix timestamp by usin

4条回答
  •  孤街浪徒
    2021-01-30 06:45

    for UNIX time-stamp in milliseconds

    moment().format('x') // lowerCase x

    for UNIX time-stamp in seconds moment().format('X') // capital X

提交回复
热议问题