Current Date/Time in UTC
// Path 1
Instant instantNow = Instant.now();
// Path 2
ZonedDateTime now = ZonedDateTime.now();
Current Date/Time in 'America/New_York' Timezone:
ZoneId americaNewYork = ZoneId.of("America/New_York");
// Path 1
Instant.now().atZone(americaNewYork);
// Path 2
ZonedDateTime.now().atZone(americaNewYork);
Full list of Zone IDs: Java Time Zone Ids
String outputFormat = "MMMM dd yyyy";
DateTimeFormatter inputFormatter = DateTimeFormatter.ISO_DATE;
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormat).withLocale(Locale.US);
LocalDate parsedDate = LocalDate.from(inputFormatter.parse(inputDate));
String outputDate = parsedDate.format(outputFormatter);
String inputFormat = "MMMM dd, yyyy";
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(inputFormat).withLocale(Locale.US);
DateTimeFormatter outputFormatter = DateTimeFormatter.ISO_DATE;
LocalDate parsedDate = LocalDate.from(inputFormatter.parse(inputDate));
String utcDate = parsedDate.format(outputFormatter);