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))
How to avoid multiple button click at same time in android?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
What is Android Fragments?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
What is "shared preferences" in Android ?
What is the difference between match_parent and fill_parent?
How to check Android version?
What are the notifications available in android?
How to install/ uninstall apk by command line ADB
How to find Android Device UDID or unique ID?
Add Jar/Library Files as Dependency in Android Studio
What is ANR in android?
How to get screen size (width,height) in Android?
How to start a new activity on button click
Fix Play Store Rejection Due to SMS Permission - RRutors
How to convert milli seconds to hours, minutes and seconds in Android?
How to get a contact image using a phone number in android?
Explain Fragment Life Cycle
How to Exit android app on back pressed?
What are Android Versions available?
Android Studio project R can't find
What is the Different Between val and var in Kotlin?
FCM Not Receiving Notifications in Android - RRutors
How do I generate random numbers in Dart?
What is Context?
What is Intent? What is the difference between an implicit intent and an explicit intent?
Decompile APK Files: How to Get Source Code - RRutors Guide
What happens next when the device switches between portrait and landscape?
How to convert DP to Pixel and Pixel to Dp?
How to validate email address in Android with Kotlin?
How to save activity State in Android?
How to Use Deprecated Handler() in Android - RRutors Guide
How do i load image from drawable folder in Jetpack Compose?
What is Android?
What is ANR? How to avoid and resolve it?
How to Generate signed apk with android studio
How To Set Text Color Programmatically Android TextView?
What is NetworkOnMainThread Exception?
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.