How to check if input date exists between two date columns? Nodejs sequel
P粉237689596
P粉237689596 2024-03-30 23:52:55
0
1
415

The date entered by the user is to check whether the date is between or exists between the start_Date column and the end_Date column of the MySQL database. Using NodeJS

P粉237689596
P粉237689596

reply all(1)
P粉547170972

If you use Sequelize for this type of query, you can use the Op.gte and Op.lte operators to achieve these two comparisons:

const records = model.findAll({
  where: {
    start_Date: {
      [Op.lte]: date
    },
    end_Date: {
      [Op.gte]: date
    },
  }
})
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!