Greets,
I am trying to return "Appointment" DataObjects in the morning in one function, and then in the afternoon in another. It's throwing an error due to the double "and"'s in the statement. I have never used BETWEEN before in SS.
DataTypes being used are Date and Time.
function getMorningAppointments() {
$today = date('Y-m-d');
$appointments = DataObject::get("Appointment", "`Date` = '{$today}' AND `Time` BETWEEN '07:00:00' AND '11:59:59'");
return $appointments;
}
function getAfternoonAppointments() {
$today = date('Y-m-d');
$appointments = DataObject::get("Appointment", "`Date` = '{$today}' AND `Time` BETWEEN '12:00:00' AND '23:59:59'");
return $appointments;
}
Any pointers greatly appreciated.