So just as the title states my code is just throwing out the minutes part of any input time. Can't find any common questions so I'm making one. Code below
import java.util.Scanner;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
public class NewMain {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("\nDeparture time (HH:MM): ");
String timeText = scanner.next();
LocalTime time= LocalTime.parse(timeText, DateTimeFormatter.ofPattern("HH:MM"));
System.out.print(time);
}
}
If anyone can tell me what I'm doing wrong it would be grateful.