[android/kotlin]현재시간 구하기

HR SO·2021년 6월 10일
0

Long -> String

fun main() {

    val currentTime = System.currentTimeMillis()

    convertTimestampToDate(currentTime)

}

fun convertTimestampToDate(timestamp: Long) {
    val sdf = SimpleDateFormat("yyyy-MM-dd-hh-mm")
    val date = sdf.format(timestamp)

    println(date) //2021년06월10일02시37분
}

출처: https://youngest-programming.tistory.com/352

profile
Mobile Developer

0개의 댓글