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))
Android Studio project R can't find
Explain Fragment Life Cycle
What happens next when the device switches between portrait and landscape?
Add Jar/Library Files as Dependency in Android Studio
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How do I check in SQLite whether a table exists?
What is ANR? How to avoid and resolve it?
Fix Play Store Rejection Due to SMS Permission - RRutors
Key Points to remember while develop the Android Application.
What are Android Versions available?
How to stop EditText focus at Activity startup in Android?
What is Intent? What is the difference between an implicit intent and an explicit intent?
How do I generate random numbers in Dart?
What is Context?
How to Get bitmap from drawable: Android
How to Generate signed apk with android studio
How to get an image resource by it's name in android?
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
How to Exit android app on back pressed?
How to convert DP to Pixel and Pixel to Dp?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
How to Use Deprecated Handler() in Android - RRutors Guide
Fix Android Emulator Kill Error When Running Your App
What is the difference between match_parent and fill_parent?
Decompile APK Files: How to Get Source Code - RRutors Guide
What is Android?
How to check Android version?
How to get a contact image using a phone number in android?
How to copy database from assets folder in android using kotlin
What is NetworkOnMainThread Exception?
Extract Date and Time from Long Type Variable - RRutors
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
Open PDF in Google Drive with Intent in Android - RRutors
How do i load image from drawable folder in Jetpack Compose?
How to save activity State in Android?
What is Application?
How can i comment inside xml file in android studio?
How to install/ uninstall apk by command line ADB
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.