I'm developing an application for android that has to list activities with its date and time. I would like to ignore the time zone of the device and show always the time in timezone +02:00.
The application is for Spain, but If someone from UK that is in another time zone use the application I want that the time for activities appear in local spanish time.
The date is in UTC format, using Calendar.getTime().toLocaleString(), the time appers in local time zone of device.
I would like to know if the is a way to set a default time zone that has to use my application, and when I invoke Calendar.getTime().toLocaleString() method get the time always in local time zone +2 despite of the device timezone
TimeZone.setDefault(TimeZone.getTimeZone("GMT+3"));
This sets the default timezone. Subsequent calls to Calendar.getInstance()
always return as if the device was in that timezone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With