3

I'm Using momentjs to find the time until a date.

moment(end).locale('nl').fromNow('s')

Currently using this, only this this returns 1 day

I'm looking for something like 86400

Is this possible with momentjs?

Ivo
  • 2,588
  • 6
  • 25
  • 43
  • 2
    Possible duplicdate of: https://stackoverflow.com/questions/41508796/moment-js-how-to-use-fromnow-to-return-everything-in-hours – k0pernikus Mar 08 '18 at 16:29
  • 1
    You can also see [How to make moment.js show relative time in seconds?](https://stackoverflow.com/q/42216583/4131048) – VincenzoC Mar 08 '18 at 16:33

2 Answers2

0

I manage to fix it using the following line of code

moment().diff(end, "seconds")

Note: this will give a negative time

Ivo
  • 2,588
  • 6
  • 25
  • 43
0

as of October 2018 , you can also do this :

  const date = '20181031'
  const time = '16:25:26'

  console.log(moment().diff('2018/10/31 18:14:00')) // time difference  in milliseconds
amdev
  • 6,703
  • 6
  • 42
  • 64