유닉스 시간 한글로 변경하기(날짜와 시간을 따로)

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);
}

댓글

이 블로그의 인기 게시물

API 요청 URL(URI) 만들기(조합하기) -Uri.Builder사용하기-

TextView에 글자를 넣어주는 방법(setText, append)

텍스트 뷰의 배경을 원형 이미지로 지정하고, 배경 색상 채우기(안드로이드)