I am trying to develop an application. Within the application I want to check if the current time falls between time ranges ,what I've completed now that it checks the hour & minute but the Time Set which is the AM/PM is ignored and always gives a wrong result My application let the user set a start time & end time and after clicking "check button" it checks if the current time if it falls within the range , I only need a way to take the factor of AM/PM into consideration so I hope you can give me a hint or something that can help thanks in advance
curhour : current hour
startTimeHour : Hour Start Range
endTimeHour : Hour End Range
same for minutes
if(curhour>=startTimeHour&&curhour<=endTimeHour)
{
if(curmin>=startTimeMin&&curmin<=endTimeMin)
{
Toast.makeText(getApplicationContext(),"Time In Range", Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(getApplicationContext(),"Out of Range", Toast.LENGTH_SHORT).show();
}