'Javascript: Mysql date and time duration

I have a little problem when filtering a record, what I want is the query will return true if the date is not in the record, the query result will only be false if the newDate(form) is in between the startDate(field) and the duration(field)

var newDate = "15/04/2022 10:07 AM"

var duration = 3600000

This is my current query

sql = "SELECT startDate FROM Event WHERE startDate BETWEEN '" + moment(newDate).startOf(`day`) + "' AND '" + moment(newDate).endOf(`day`) + "'
if(sql.length > 0){
  valid = true
}else{
   valid = false
}

record inside the database

I've tried this

"SELECT id, startDate, FROM_UNIXTIME(duration / 1000) FROM Event WHERE '" + date + "' BETWEEN startDate AND FROM_UNIXTIME(duration / 1000)"

i've got always nothing

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source