Example:
public static void main(String[] args) {
String input = "2021-02-11T09:00:01-07:00 --UTC";
String timeStampCleanedUp = input.replaceFirst("\\s+--UTC", "");
ZonedDateTime zonedDateTimeTmp = ZonedDateTime.parse(timeStampCleanedUp);
//Conevert to other TimeZone, such as 'America/New_York':
ZonedDateTime zonedDateTime = zonedDateTimeTmp.withZoneSameInstant(ZoneId.of("America/New_York"));
System.out.printf("Time stamp after zone time conversion: from '%s' to '%s'%n%n", zonedDateTimeTmp, zonedDateTime);
//day, daynumber, date, month, year, time,timezone
Map<String, String> result = new HashMap<>();
result.put("DayOfWeek", zonedDateTime.getDayOfWeek().name()); //Day
result.put("DayOfMonth", String.valueOf(zonedDateTime.getDayOfMonth())); //DayNumber
result.put("Month", zonedDateTime.getMonth().name()); //Month
result.put("Date", zonedDateTime.toLocalDate().toString()); //Date
result.put("Month", zonedDateTime.getMonth().name()); //Month
result.put("Year", String.valueOf(zonedDateTime.getYear())); //Year
result.put("Time", zonedDateTime.toLocalTime().format(DateTimeFormatter.ISO_LOCAL_TIME)); //Time
result.put("Offset", zonedDateTime.getOffset().getId()); //Offset
result.put("TimeZone", zonedDateTime.getZone().getId()); //TimeZone
result.keySet().stream().sorted().forEach(key -> System.out.printf("Key: '%s' => Value: '%s'%n", key, result.get(key)));
}
Output:
Time stamp after zone time conversion: from '2021-02-11T09:00:01-07:00' to '2021-02-11T11:00:01-05:00[America/New_York]'
Key: 'Date' => Value: '2021-02-11'
Key: 'DayOfMonth' => Value: '11'
Key: 'DayOfWeek' => Value: 'THURSDAY'
Key: 'Month' => Value: 'FEBRUARY'
Key: 'Offset' => Value: '-05:00'
Key: 'Time' => Value: '11:00:01'
Key: 'TimeZone' => Value: 'America/New_York'
Key: 'Year' => Value: '2021'
You can see Available Zone Ids by using ZoneId.getAvailableZoneIds():
ZoneId.getAvailableZoneIds().stream().forEach(System.out::println);
You can read more about ZonId and ZoneOffset here:
https://docs.oracle.com/javase/10/docs/api/java/time/ZoneId.html
https://docs.oracle.com/javase/10/docs/api/java/time/ZoneOffset.html