-1

I am getting from a service - Date object that contains an UTC time zone date.

How can i change it to the current phone time zone?

Montoya
  • 2,819
  • 3
  • 37
  • 65

1 Answers1

1

Something like this:

SimpleDateFormat fmt = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a");
Date getDateTime = fmt.parse(utcDateAndTime);
fmt.setTimeZone(TimeZone.getDefault());
String getLocalDateTime = fmt.format(getDateTime);
System.out.println("Local date/time: " + getLocalDateTime);
David S.
  • 6,567
  • 1
  • 25
  • 45