0
RSS 피드의 시간을 현지 시간으로 변환하고 싶습니다. RSS 피드에서 보이는 모습은 다음과 같습니다.시간을 현지 시간으로 변환
내가 원하는 것은 22:13을 거기에서 가져 와서 현지 시간으로 변환하는 것입니다. 코드는 다음과 같습니다.
if (current.getNodeName().equalsIgnoreCase("pubDate")) {
SimpleDateFormat inputFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
Calendar cal = Calendar.getInstance();
cal.setTime(inputFormat.parse(currentTextContent.substring(5, 16)));
SimpleDateFormat outputFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US); // 01-12
outputFormat.setTimeZone(TimeZone.getDefault());
String postTime = outputFormat.format(currentTextContent.substring(17, 22));
rssFeedModelItem.setPubDate(outputFormat.format(cal.getTime()));
System.out.println("Time"+" "+postTime);
rssFeedModelItem.setPubTime(postTime);
}
이 코드 앱을 사용하면 이상한 인터넷 연결 오류가 나타나지 않습니다. 이를 제거한 후 :
String postTime = outputFormat.format(currentTextContent.substring(17, 22));
그리고 변화
rssFeedModelItem.setPubTime(postTime);
이로 :
rssFeedModelItem.setPubTime(currentTextContent.substring(17, 22));
응용 프로그램이 작동하지만, RSS 시간을 보이고있다. 나는 또한 this 솔루션을 시도했지만 효과가 없습니다. 어떤 도움을 주셔서 감사합니다. 감사합니다.
그래로 전체 날짜를 구문 분석을 시도 할 수 있지만 전체 날짜가 필요하지 않습니다. 시간을 다른 시간대로 변환하기 만하면됩니다. 가능하지 않니? –
날짜를 파싱 한 후에는 다른 포맷터를 사용하여 원하는 시간대에 원하는 것을 인쇄 할 수 있습니다 – elmorabea