Show message based on
A cleaner method for detecting date would be.
//the time cannot go below zero, so if this case is true, it must be between 0 and 12
if(time <= 12)
{
return "Good Morning";
//it will only fall into this case if the time is greater than 12.
}else if(time < 16)
{
return "Good Afternoon";
}else if(time < 21)
{
return "Good Evening";
}else //it is guaranteed that the time will not exceed 24
//, and if the previous case are all false, it must be within 21 and 24
{
return "Good Night";
}