Tengo una marca de tiempo que está en UTC y quiero convertirla a la hora local sin usar una llamada API como TimeZone.getTimeZone("PST")
. ¿Cómo se supone que debes hacer esto? He estado usando el siguiente código sin mucho éxito: valor de entradaJava: ¿Cómo se convierte una marca de tiempo UTC a hora local?
private static final SimpleDateFormat mSegmentStartTimeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(mSegmentStartTimeFormatter.parse(startTime));
}
catch (ParseException e) {
e.printStackTrace();
}
return calendar.getTimeInMillis();
muestra: [2012-08-15T22:56:02.038Z]
debe devolver el equivalente de [2012-08-15T15:56:02.038Z]
Cool realmente funcionó. Pude obtener la zona horaria predeterminada del dispositivo Android llamando a TimeZone.getDefault(). –