@Query("Select * From Mstudent where (strftime('%d%m',dob)) = :todayDate order by (strftime('%d%m',dob))")
List<Mstudent> getStudentByBirthDate(Date todayDate);
this is what I have done but this is giving me an error because the query is not right. can we filter by date and month only and ignoring year?
Try this query (in case you use TypeConvertor Date
to Long
):
@Query("Select * From Mstudent where strftime('%d%m',datetime(dob/1000, 'unixepoch'))= strftime('%d%m',datetime(:todayDate/1000, 'unixepoch')) order by strftime('%d%m',dob)")
List<Mstudent> getStudentByBirthDate(Date todayDate);