SimpleDateFormat failed to convert the time: it was supposed to convert to the hour, but it somehow changed to the minute

public static void main(String[] args) throws ParseException { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String format = sf.format(sf.parse("2019-03-22 08:00").getTime() + Integer.parseInt("597") * 60 * 60 * 1000); System.out.println(format); Date d = sf.parse(format); GregorianCalendar gc = new GregorianCalendar(); gc.setTime(d); If ((gc) get (12) = = 0) && (gc) get (13) = = 0)) System. Out. The println (" the hour "); Else System.out.println(" not the hour "); }Copy the code

Solution: String format = sf.format(sf.parse(“2019-03-22 08:00”).getTime() + integer.parseInt (“597”) * 60 * 60 * 1000L);

It worked! That’s how good it is!