I'm trying to compare two datetimes but I can't get it to work.
public void time () {
Calendar c11 = Calendar.getInstance ();
c11.add(Calendar.DAY_OF_YEAR, 0);
c11.set(Calendar.HOUR_OF_DAY, 9);
c11.set(Calendar.MINUTE, 0 );
c11.set(Calendar.SECOND, 0);
Calendar c12 = Calendar.getInstance ();
c12.add(Calendar.DAY_OF_YEAR, 0);
c12.set(Calendar.HOUR_OF_DAY, 9);
c12.set(Calendar.MINUTE, 0 );
c12.set(Calendar.SECOND, 0);
c11.getTime();
c12.getTime();
boolean k = c11.equals(c12);
if (k==true)
{
Toast.makeText(
getContext(),
"Wow these two times are the same!",
Toast.LENGTH_LONG).show();
}
}
}