1980 년 1 월 6 일부터 시작되는 특정 시간 (초)을 YYYY/MM/DD HH : mm : ss와 같은 UTC 형식으로 변환하는 직접적인 방법이 있습니까?GPS 시간 (밀리 초) UTC 형식
편집 :
private Date gpsInit;
//...
try{
String ds = "06/01/1980";
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
gpsInit = df.parse(ds);
}
catch(ParseException e) {
System.out.println("Unable to parse January 6th 1980");
}
textField = new JFormattedTextField(format);
textField.setText(formatUTC(min));
//...
private String formatUTC(int timeValue) {
long diference = timeValue + gpsInit.getTime()/1000;
String pattern = "yyyy/MM/dd HH:mm:ss";
SimpleDateFormat utcFormat = new SimpleDateFormat(pattern);
Date utcNow = new Date(diference*1000);
return utcFormat.format(utcNow);
}
윤초 문제가 될 수 있습니다. – CodesInChaos
비슷한 질문 : [GPS 시간 표현 라이브러리] (http://stackoverflow.com/q/3038229/642706). –