I am having tbl_batch
which has
id
title
start_date
start_time
end_time
venue_id
created_by
In the database start_time and end_time is being saved as time()
Row:-
id 1
title test
start_time 10:10
end_time 11:30
venue_id 1
start_date 2020-03-01 (Y-m-d)
created_by 1
So I would like to check if time is between start_time
and end_time
with the given start_date
.
Query I have tried :-
$model = Batch::find()->where([
'start_date' => '2020-03-01',
'venue_id' => 1
])->andWhere([
'AND',
[ '>=',
'start_time',
'10:20'
],
[ '<=',
'end_time',
'19:20'
]
]);
if($model->exists()){
echo 'Already exists in DB';
}else
{
echo 'Does not Exist';
}
This is not returning the correct output .