tl;dr
LocalDateTime.parse ( "2025-01-31T12:27:00" )
Two Date classes
Java includes two classes named Date, java.util.Date and java.sql.Date. The first represents a moment as seen with an offset from UTC of zero hours-minutes-seconds. The second pretends to represent a date-only value, but actually contains a moment. We cannot tell which you tried to utilize.
Both classes are terribly-flawed, both are legacy, and both should be avoided. So your Question is moot. You should instead be using only the java.time classes for your date-time work. Never use Date, Calendar, SimpleDateFormat, etc.
java.time.LocalDateTime
Neither of those legacy classes is meant to represent the content of your input text. Your input text contains a date with a time-of-day but lacks the context of a time zone or offset. So parse as a LocalDateTime object.
Your input text complies with the standard ISO 8601 used by default in the java.time classes. So no need to specify a formatting pattern.
String input = "2025-01-31T12:27:00" ;
LocalDateTime ldt = LocalDateTime.parse ( input ) ;
Dateclass did you import? It doesn't look to me likejava.util.Date.java.time.LocalDateTimeand use its functionLocalDateTime.parse(curdate)which will at least work for your example value ofcurdatebecause it has the expected format.curHour = ldt.toLocalTime().getHour();curMin = ldt.toLocalTime().getMinute();You should be doing this asjava.util.Datehas long been superseded