I am using this code to give me GMT time:
Time now = new Time();
now.setToNow();
The time is in GMT but I am in GMT+12. Is there a very simple way to get the time in GMT+12?
Thanks.
I am using this code to give me GMT time:
Time now = new Time();
now.setToNow();
The time is in GMT but I am in GMT+12. Is there a very simple way to get the time in GMT+12?
Thanks.
Use Time(String timezone)
constructor:
Time now = new Time(Time.getCurrentTimezone());
TimeZone tz = TimeZone.getTimeZone("GMT+12:00");
Calendar c = Calendar.getInstance(tz);
String time = c.get(Calendar.HOUR_OF_DAY)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND);
Log.e("time","is"+time);