I have a java application where in the User can not modify the order after a specific date and time .eg.the user can not modify the order after the 3rd day by 12:00 PM ,say if the order was placed on Nov 9th ,the user will not be able to modify the oder after Nov 12th ,12:00 PM .The Date is Dynamic but the time is very much static.
I was trying to use the below logic to calculate this and i am unable to figure out how to extract the current time from LocalDateTime.now() for comparison.
final LocalDate orderDate =orderData.getOrderDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
final LocalDate currentDate = LocalDate.now();
final LocalDateTime currentDateTime = LocalDateTime.now();
final LocalDate orderCancellationCutOffDate =
orderDate.minusDays(orderCancellationCutOffDays);
if (currentDate.equals(orderCancellationCutOffDays) &&
currentDateTime.isBefore(<12:00 PM>)){
<Business rule>
}
Can anyone help me with an efficient way to do this comparison.