1

I'm programming an app that users have to make reservation. The problem is that when i I use in android studio calendar.getinstance() i get the date, but if I change the date in the settings in my android when I run again the app, the calendar get the new date that i set in the settings and this is a big problem. No matter if i change the date in my phone the app have to display the current date. I tried with timezone and didint work. The date that I want is the date of Argentina. I have the same problem with the time.

Somebody help me please? WhatsApp detect if you change the time for example. May be I can do something like this but I don't know how!

I use date picker for choose the date Thanks!

yole
  • 92,896
  • 20
  • 260
  • 197
  • 1
    The only date/time available is the date/time of the phone. If your code *absolute require* "true date/time", regardless of the date/time on the phone, then you need to get it from an external time server. – Andreas Feb 01 '16 at 10:23

1 Answers1

0

If you allways need the date/time of Argentina you can look witch timezone the phone is configured. You calculate it back to GMT (0) and then calculate it to Argentina timezone. Is that what you mean? Your app is then displaying allways the Argentina time. Iám not an Android developer so i cant tell you how to look this in code.

If this not is an solution for you then i think you need to get the time from an external timeserver as Andreas said.

Hope this helps you in the right direction....

CodeNinja
  • 836
  • 1
  • 15
  • 38
  • As i said, iam not an android developer. I think the following 2 stack overflow topics can help you... one topic describes how to get the timezone, the other how to calculate with it. [link]http://stackoverflow.com/questions/7672597/how-to-get-timezone-from-android-mobile[/link][link] http://stackoverflow.com/questions/16494929/calculating-timezone-from-gmt-value-android[/link] The Argentinia timezone is -3 ;-) Hope it works :-D – CodeNinja Feb 01 '16 at 11:23
  • When this answers your question, dont forget to accept the answer. http://stackoverflow.com/help/accepted-answer – CodeNinja Feb 03 '16 at 14:33