Skip to content
Advertisement

Tag: timezone-offset

Converting Time Zone to GMT values in Java 11

We keep time zones of the cities in our config table using ID of Time Zone values as Europe/London, Asia/Tokyo, etc. However, when selecting time zones from the list, user needs to see the GMT values for these time zones and we want to display Display Name of Time Zone Options as (UTC+00:00) Dublin, Edinburgh, Lisbon, London rather than Europe/London.

Can’t get local and utc Instant

I need to get local time and utc time in seconds. I read some posts in StackOverflow and found some solution, which is correct as mentioned: But result is not what I expected. It is utc time. The output: After debugging I found that Instant.now() is already utc. I can’t find how to get time in current time zone, i.e.

Advertisement