I have a back-end job that runs once a day and is scheduled at a particular time based on the entity/user etc.
Now, I want to validate if the current time is earlier than the job, if yes, then job can be rescheduled, else if job has already passed, then of course it cant be rescheduled for the day.
public static String getCurrentTime(String format) {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(cal.getTime());
}
String time = getCurrentTime("yyyy-MM-dd HH:mm:ss");
String backendJobTime = getBackendJobSchedule();
String[] onlyTime = time.split("\\s+");
String time = onlyTime[1];
Integer.parseInt(time);
Same for back-end job
if(time < backendJob){
system.out.println("Job is yet to be exectued...):
}
Now,Ii want to get substring of time and then compare with other time of the back-end job and see if it's earlier. I can't write the complete logic.