I expect the below code to output: 20181104 05
But it outputs: 20181104 06
Why is that? I also double checked on this site and they got it right.
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd HH");
dateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York"));
Date date = dateFormat.parse(20181104 + " " + 1);
dateFormat = new SimpleDateFormat("yyyy MM dd HH");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println(dateFormat.format(date));