I have two inputs:
- a date value
- an integer (+8 or -3 or such) that represents the offset from GMT
Using Java, how can I convert the given date value into the corresponding date/time in the local timezone? There doesn’t seem to be any timezone offset function in the Date class.
Thanks!
TimeZone
withsetRawOffset
with code from this answer: https://stackoverflow.com/a/19378721/360211I think you need to use the TimeZone.getAvailableIDs(rawOffsetinMiliSeconds) to get a timezone value. Working Example: