1

Dear Friends,

I am developing on android application for one Indian city,In my application contain information about some Indian city like weather,some place and current time. I need solution for wherever user launch my application ,my application will display Indian city's current time.How is possible to applicable this logic,Basically i display time for device's current time in my app.so i am struggle with this part.please give solution for that.

Thanks Friends

John
  • 217
  • 2
  • 7
  • 13

3 Answers3

1

Use this code:

    TimeZone tz = TimeZone.getTimeZone("GMT+5:30");
    Calendar date = Calendar.getInstance(tz);
Mandel
  • 2,968
  • 2
  • 22
  • 19
0

Its pretty difficult to understand your problem, next time try to make it clearer. If you need to display the time which is stored in the device just use

getTime()

For weather you need to use Google's weather service and retrieve values form the server.

For IST Use this time server

time-a.nist.gov Or http://www.pool.ntp.org/zone/asia

just use anyone of these

Arveen
  • 868
  • 6
  • 18
  • i asked,In case user launch my app in USA,I want to display India's time,I don't want current device's time. – John Jul 15 '11 at 10:14
0

If i understand your question correct, you need to display current IST regardless of the device timezone.

If that is the case, then you would need to get UTC and convert it to IST. As an example, refer this SO .question

Community
  • 1
  • 1
chedine
  • 2,384
  • 3
  • 19
  • 24