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))
Set Activity to Fullscreen Mode in Android - RRutors
What is the Different Between val and var in Kotlin?
What is the difference between match_parent and fill_parent?
How do I check in SQLite whether a table exists?
Open PDF in Google Drive with Intent in Android - RRutors
How to install/ uninstall apk by command line ADB
What is NetworkOnMainThread Exception?
How can i comment inside xml file in android studio?
Decompile APK Files: How to Get Source Code - RRutors Guide
What is ANR? How to avoid and resolve it?
How to avoid multiple button click at same time in android?
How to Use Deprecated Handler() in Android - RRutors Guide
What is Context?
Invoke-customs are only supported starting with android 0 --min-api 26
How To Set Text Color Programmatically Android TextView?
Extract Date and Time from Long Type Variable - RRutors
What are Android Versions available?
Explain Fragment Life Cycle
Android Studio project R can't find
What is Application?
What is Intent? What is the difference between an implicit intent and an explicit intent?
Key Points to remember while develop the Android Application.
FCM Not Receiving Notifications in Android - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
Fix Duplicate Files in APK Build.gradle Issue - RRutors
What is ANR in android?
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
Check List for Generate Signed APK Android
What is Android?
Fix Android Emulator Kill Error When Running Your App
How to get complete address from latitude and longitude?
How to Exit android app on back pressed?
How to get a contact image using a phone number in android?
How do i load image from drawable folder in Jetpack Compose?
What are the notifications available in android?
How to copy database from assets folder in android using kotlin
How to save activity State in Android?
How do I generate random numbers in Dart?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
How to validate email address in Android with Kotlin?