유닉스 시간 한글로 변경하기(날짜와 시간을 따로)
Date dateObject = new Date(유닉스 시간);String formattedDate = formatDate(dateObject);
String formattedTime = formatTime(dateObject);
private String formatDate(Date dateObject) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy년 MM월 dd일 E요일", Locale.KOREAN);
return dateFormat.format(dateObject);
} private String formatTime(Date dateObject) { SimpleDateFormat timeFormat = new SimpleDateFormat("a h시 mm분", Locale.KOREAN);
return timeFormat.format(dateObject);
}
댓글
댓글 쓰기