java - Get Greenwich Mean Time -


India Standard Time (IST) is ahead of 5:30 hours (5 hours 30 minutes) Greenwich Mean Time. We show it as GMT + 5.5.

Is there a way to find this value (in the case above, value = 5.5) by time zone?

In my Android app, I can get the time zone of the device. But how can the device get this value using time zones?

  double time zone = 0.0; Calendar cal = calendar.justinstance (); Cal.set (mn.Year (), mn.Month (), mn.day (), mn.Hour (), mn.minute (), (int) mn.second ()); Timezone tees = timezone.gate default (); Boolean T = tz.inDaylightTime (cal.getTime ()); If (t) time zone = ((timezone.get default). GetRawOffset ()) / (60 * 60 * 1000d) + (timezone.get default) .getDSTSavings () / (60 * 60 * 1000d)); And timezone = ((timezone.gate default). GetRawOffset ()) / (60 * 60 * 1000D));   

You can try this code. This will give you time zone value. If you want a different time zone value; Just timezone tees = timezone.get default (); to

  timezone tees = timezone.get time zone ("Asia / Kolkata"); TimeZone.setDefault (TZ);   

This will work for you.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -