I am using momentJs for finding difference from now to a specific date as below:
moment([MyDate]).fromNow();
The code gives me results as below:
"a few minutes ago" or "10 hours ago" ...
I tried to change that as below to find difference as seconds
moment([MyDate]).fromNow().asSeconds();
but the code doesn't work.
So I would like to implement codes like Twitter's last update notification. Any suggestion?
If you want to make the diff between 2 dates in seconds :
moment().diff(mydate, 'seconds')