How big is the time?

simple time comparison
time1 = 15:30:26
time2 = 17:00:00
how to compare these two times, ask the boss for advice

Jul.14,2022

you can use moment.js

moment('2016-05-04').isBefore('2016-05-16')

isn't it easy to calculate if it's just minutes and seconds? Just turn it all into seconds and compare the size.
it is more convenient to use moment or dayjs if you are the one with a date. Convert it to Date, and then Date.getTime () for comparison.


makeDurationToSeconds (time) {

  let str = time
  let arr = str.split(':')
  let hs = parseInt(arr[0] * 3600)
  let ms = parseInt(arr[1] * 60)
  let ss = parseInt(arr[2])
  let seconds = hs + ms + ss
  return seconds
},

returns a comparison in seconds, and I compare it in a second.


Direct comparison is fine

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-1b3b7ea-412dc.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-1b3b7ea-412dc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?