Getting difference in seconds from two dates in JavaScript

后端 未结 2 1937
时光说笑
时光说笑 2021-01-16 00:01

I have dates stored in MongoDB using Date(), MongoDB uses UTC it\'s date type, and as a string looks like Mon, 02 Apr 2012 20:16:31 GMT.

I want to get t

2条回答
  •  醉酒成梦
    2021-01-16 00:39

    (end_date.getTime() - current_date.getTime()) / 1000

    getSeconds will return only seonds, but not minutes, hours, etc.

提交回复
热议问题