How can I validate a date between two of the same table

Sorry for my english, I do not know much, but I need help with something, how can I validate if a date entered from a form is within the range of two dates in the same table, is to control that a record can not be added with a Date that is within a range that is already in database

Hi,

try this…

$Query = $Table
->find()
->where([
‘start_date BETWEEN :start AND :end’
])
->bind(‘:start’, ‘2014-01-01’, ‘date’)
->bind(‘:end’, ‘2014-12-31’, ‘date’);