I'm trying to get the range of time from 8:00 am to 8:00 pm and 8:00 pm to 8:00 am, I'm trying to get schedules to display it in the recyclerview from firebase.
This is the code that I've structured.
Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
min = c.get(Calendar.MINUTE);
sec = c.get(Calendar.SECOND);
int ds = c.get(Calendar.AM_PM);
if(ds==0)
AM_PM="am";
else
AM_PM="pm";
Toast.makeText(getActivity(), ""+hour+":"+min+AM_PM, Toast.LENGTH_SHORT).show();
if (hour >= 8 && AM_PM.matches("am") || hour >= 12 && AM_PM.matches("pm") || hour <= 7 && min <=59 && sec <=59 && AM_PM.matches("pm") ){
fill_with_data_shift1();
}else if (hour >= 20 && AM_PM.matches("pm") || hour >= 00 && AM_PM.matches("am")){
fill_with_data_shift2();
}