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?
How to Get bitmap from drawable: Android
Invoke-customs are only supported starting with android 0 --min-api 26
What is ANR? How to avoid and resolve it?
How to convert milli seconds to hours, minutes and seconds in Android?
Key Points to remember while develop the Android Application.
FCM Not Receiving Notifications in Android - RRutors
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to get an image resource by it's name in android?
How to start a new activity on button click
Android Studio project R can't find
Add Jar/Library Files as Dependency in Android Studio
How to save activity State in Android?
How do I generate random numbers in Dart?
How to reduce APK package size?
How to stop EditText focus at Activity startup in Android?
How To Set Text Color Programmatically Android TextView?
How to get complete address from latitude and longitude?
What is the difference between match_parent and fill_parent?
How can i comment inside xml file in android studio?
How to avoid multiple button click at same time in android?
What is NetworkOnMainThread Exception?
Extract Date and Time from Long Type Variable - RRutors
How to get a contact image using a phone number in android?
What is ANR in android?
How to convert DP to Pixel and Pixel to Dp?
How to copy database from assets folder in android using kotlin
Explain Fragment Life Cycle
Symmetric vs Asymmetric Encryption in Android Server - RRutors
Hide/Disable soft keyboard on Activity launch: Android
How to Exit android app on back pressed?
Set Activity to Fullscreen Mode in Android - RRutors
How to Generate signed apk with android studio
What are Android Versions available?
How to get screen size (width,height) in Android?
Fix Play Store Rejection Due to SMS Permission - RRutors
What are the notifications available in android?
How to install/ uninstall apk by command line ADB
What is Context?