An Ish A
An Ish A

Reputation: 711

How to get DateTimeZone Name from a dateTimeZone offset value

Is there a way to create a (joda) DateTimeZone object from a time zone string representation, like , or "GMT -05:30"?

OR

There is any alternate way to get 'IST' from "GMT -05:30" or from gmtoffsetValue.

Upvotes: 0

Views: 133

Answers (2)

Robin Krahl
Robin Krahl

Reputation: 5308

If the input string has a fixed format, you can parse the offset using a regular expression and then get the corresponding DateTimeZone object by the DateTimeZone.forOffsetHoursMillis(int, int) method.

Upvotes: 1

String[] timezones = TimeZone.getAvailableIDs(offset);

more info in: http://www.javacoderanch.com/how-to-get-timezone-ids-by-their-milliseconds-offset.html

Upvotes: 0

Related Questions