Advertisement
Guest User

compare between Time.now() with constant time

a guest
Jun 26th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. private Boolean isStudentLate() {
  2. boolean studentLate = false;
  3. try {
  4. String inTime = "07:15";
  5. SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  6. Date parsedInTime = sdf.parse(inTime);
  7. SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
  8. Date currentTime = new Date();
  9. if (Integer.getInteger(dateFormat.format(currentTime)) > Integer.getInteger(dateFormat.format(parsedInTime))) {
  10. studentLate = true;
  11. }
  12. } catch (Exception ex) {
  13. Log.e("AppUtils", "Error " + ex);
  14. }
  15.  
  16. return studentLate;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement