I need to find difference between current dateTime LocalDateTIme.now()
and another LocaDateTime
object called issueDateTime
in number of days. Also days to be counted starting from the time in issueDateTime
. That is, if issueDateTime
is 12/04/2014 5:00 pm days should be counted as per 5 pm and not 12 am. I want to find the difference between issue date and current date in days and then multiply it with rentalTariff/day to return amount from method amountPayable()
. thanks
public class RentOut {
private int rentalTariff ;
private LocalDateTime dateTime;
private String rentedTo;
private LocalDateTime returnDateTime;
public RentOut(int rentalTariff) {
this.rentalTariff = rentalTariff;
}
public void RentIt(LocalDateTime dateTime, String rentedTo) {
this.dateTime = dateTime;
this.rentedTo = rentedTo;
this.returnDateTime = dateTime.plusHours(24);
}
public LocalDateTime getRentDateTime() {
return dateTime;
}
public LocalDateTime returnDateTime() {
return returnDateTime;
}
public String getCustomerName() {
return rentedTo;
}
public int amountPayable() {
//return LocalDateTime.now().minus(dateTime)*rentalTariff;
}
}