var time="1587483014960"
I have a varible which gives the time in milliseconds, now i want to extract date and time from that variable. How can I do this in Kotlin?
Answers
With below code you can get time and date from given milliseconds variable
import java.text.SimpleDateFormat import java.util.Date
fun formatDateTime (time: Long): String { val date = Date(time) val format = SimpleDateFormat("dd/M/yyyy hh:mm:ss") return format.format(date) }