Data w formacie Java UTC
Mam taki sznurek2013-10-22T01:37:56
. Muszę zmienić ten ciąg na format daty UTC w ten sposóbMM/dd/yyyy KK:mm:ss a
. Próbowałem kodu, ale nie zwraca on daty UTC.
Mój kod to
String[] time = itsAlarmDttm.split("T");
String aFormatDate = time[0]+ " "+time[1];
String aRevisedDate = null;
try {
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
final Date dateObj = sdf.parse(aFormatDate);
aRevisedDate = new SimpleDateFormat("MM/dd/yyyy KK:mm:ss a").format(dateObj);
System.out.println(aRevisedDate);
} catch (ParseException e) {
itsLogger.error("Error occured in Parsing the Data Time Object: " +e.getMessage());
} catch (Exception e) {
itsLogger.error("Error occured in Data Time Objecct: " +e.getMessage());
}
Dostaję wyjścieMM/dd/yyyy KK:mm:ss a
format. Ale nie format czasu UTC. Jak rozwiązać ten problem?