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 Android Fragments?
What is Application?
How to avoid multiple button click at same time in android?
Android Studio project R can't find
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
How to Exit android app on back pressed?
How to check Android version?
How to copy database from assets folder in android using kotlin
How to get a contact image using a phone number in android?
How to convert DP to Pixel and Pixel to Dp?
Set Activity to Fullscreen Mode in Android - RRutors
How can i comment inside xml file in android studio?
How do I generate random numbers in Dart?
How to reduce APK package size?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
How to Generate signed apk with android studio
What are Android Versions available?
Extract Date and Time from Long Type Variable - RRutors
What is ANR in android?
How to start a new activity on button click
Key Points to remember while develop the Android Application.
Hide/Disable soft keyboard on Activity launch: Android
Fix Play Store Rejection Due to SMS Permission - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
What is Android?
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
How to validate email address in Android with Kotlin?
Explain Fragment Life Cycle
FCM Not Receiving Notifications in Android - RRutors
What is NetworkOnMainThread Exception?
Check List for Generate Signed APK Android
How do I check in SQLite whether a table exists?
What is Context?
How to find Android Device UDID or unique ID?
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
How To Set Text Color Programmatically Android TextView?
Permission denied for window type 2010 in Marshmallow device
What is the difference between match_parent and fill_parent?