With Below code we can get date and time import java.text.SimpleDateFormat fun convertLongToTime (time: Long): String { From API level 26 on (Android) or if JVM is your target, we can use Java 8 Date API: val date = Instant val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm") Below API level 26: val date = Date(1595386325905) val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm")
import java.util.Date
val date = Date(time)
val format = SimpleDateFormat("dd/M/yyyy hh:mm:ss")
return format.format(date)
}
.ofEpochMilli(1164925597950)
.atZone(ZoneId.systemDefault()) // change time zone if necessary
.toLocalDateTime()
println(formatter.format(date))
println(formatter.format(date))
What is NetworkOnMainThread Exception?
What is "shared preferences" in Android ?
How to install/ uninstall apk by command line ADB
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
Fix Play Store Rejection Due to SMS Permission - RRutors
What is Android?
How to validate email address in Android with Kotlin?
What is the Different Between val and var in Kotlin?
What are the notifications available in android?
Permission denied for window type 2010 in Marshmallow device
How do I generate random numbers in Dart?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
How to stop EditText focus at Activity startup in Android?
Add Jar/Library Files as Dependency in Android Studio
Open PDF in Google Drive with Intent in Android - RRutors
How to avoid multiple button click at same time in android?
How to Generate signed apk with android studio
How to reduce APK package size?
Hide/Disable soft keyboard on Activity launch: Android
Android Studio project R can't find
What is Application?
How do i load image from drawable folder in Jetpack Compose?
Invoke-customs are only supported starting with android 0 --min-api 26
Symmetric vs Asymmetric Encryption in Android Server - RRutors
What is Android Fragments?
What are Android Versions available?
What is ANR in android?
How to find Android Device UDID or unique ID?
How To Set Text Color Programmatically Android TextView?
How do I check in SQLite whether a table exists?
Set Activity to Fullscreen Mode in Android - RRutors
How to Use Deprecated Handler() in Android - RRutors Guide
What is ANR? How to avoid and resolve it?
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to get an image resource by it's name in android?
How to check Android version?
Key Points to remember while develop the Android Application.
What is Intent? What is the difference between an implicit intent and an explicit intent?
How to Exit android app on back pressed?
How to convert DP to Pixel and Pixel to Dp?