How can I get the time zone from a datetime string with this format 2013-08-15T13:00:00-07:00?
You could take the time offset from Andreas answer and use below sinppet to get TimeZone object.
TimeZone tmzo = TimeZone.getTimeZone("GMT"+offset);
System.out.println(tmzo.getID());
if Java 8, you can parse directly with ISO_ZONED_DATE_TIME format
String input = "2013-08-15T13:00:00-07:00";
ZonedDateTime zDateTime = ZonedDateTime.parse(input, DateTimeFormatter.ISO_ZONED_DATE_TIME);
ZoneId zone = zDateTime.getZone();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With