How can i know time in a specific country if i am in a differenet country?

后端 未结 2 802
醉话见心
醉话见心 2021-01-25 07:34

I am trying to do it this way 1. Get my time current time and time zone. 2. I know time zone of that specific country from Google. 3. Calculate difference in time zones. 4. Subt

2条回答
  •  旧时难觅i
    2021-01-25 08:37

    x is the time zone id, there are a link of a list of them. Only need to feed the gettimeZone("with the time zone id") with the time zone of the city you want to know the time (I'm saying city because there are country with a lot of time zones like US or Russia).

    TimeZone tz = TimeZone.getTimeZone("x")

    http://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/

提交回复
热议问题