Momentjs compares the difference between the two times by one day and eight hours.

start = +new Date()
now = +new Date()
time = moment(now - start)
console.log(time.format("D H mm ss"))

output is:

1 8 00 00

refer to the momentjs file as:

http://apps.bdimg.com/libs/mo.

what"s going on? I hope to correctly compare the difference between the two times, who can help solve it? Thank you
-
add:
-
simplify the question
moment (0). Format ("D day H mm minutes ss seconds")
how to output: 0 day 00:00:00


The time corresponding to

moment (0) is the day corresponding to D in 1970-01-01T08:00:00.000
format, and the corresponding hour to H is
, so the output time is 08:00:00 on the 1st day

.

if you want to judge the time difference, you can use the following methods

moment.locale('zh-cn')
var time = moment(new Date(), 'YYYYMMDD').from(new Date('2018/08/01 18:40:00'))
console.log(time);

//  8
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2c05b-2badb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2c05b-2badb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?