I have this field for appointment time which is of type LocalDateTime. I want to format it so that it can only accept hour and minute instead of the whole year,month,day, hour,minute etc that it normally returns. I know that I can achieve that by passing a string and a time formatter but I just want to pass the pattern directly to it
public class BookingDto {
private Long doctorId;
private Long patientId;
private LocalDate appointmentDate;
//This is the attribute
// I need it in this format 08:23
private LocalDateTime appointmentTime;
private BigDecimal totalPrice;
private Status status;
private String note;
}
Use LocalTime instead of LocalDateTime.