Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Boolean isStudentLate() {
- boolean studentLate = false;
- try {
- String inTime = "07:15";
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
- Date parsedInTime = sdf.parse(inTime);
- SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
- Date currentTime = new Date();
- Integer currentTimeInt = Integer.getInteger(dateFormat.format(currentTime));
- Integer inTimeInt = Integer.getInteger(dateFormat.format(parsedInTime));
- if (currentTimeInt != null && inTimeInt != null) {
- Log.d("AppUtils", "currentTimeInt " + currentTimeInt + "\ninTimeInt " + inTimeInt);
- if (currentTimeInt > inTimeInt) {
- studentLate = true;
- }
- } else {
- Log.e("AppUtils", "currentTimeInt OR inTimeInt is NULL");
- }
- } catch (Exception ex) {
- Log.e("AppUtils", "Error " + ex);
- }
- return studentLate;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement