I want to convert this GMT time stamp to GMT+13:
2011-10-06 03:35:05
I have tried about 100 different combinations of DateFormat, TimeZone,
The solution is actually quite simple (pure, simple Java):
System.out.println(" NZ Local Time: 2011-10-06 03:35:05");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime localNZ = LocalDateTime.parse("2011-10-06 03:35:05",formatter);
ZonedDateTime zonedNZ = ZonedDateTime.of(localNZ,ZoneId.of("+13:00"));
LocalDateTime localUTC = zonedNZ.withZoneSameInstant(ZoneId.of("UTC")).toLocalDateTime();
System.out.println("UTC Local Time: "+localUTC.format(formatter));
OUTPUT IS:
NZ Local Time: 2011-10-06 03:35:05
UTC Local Time: 2011-10-05 14:35:05