Created
April 9, 2021 20:07
-
-
Save userddssilva/70c7c2e3a7f297df81a58254f29f4572 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun convertLongToTime(time: Long): String { | |
val date = Date(time) | |
val format = SimpleDateFormat("yyyy.MM.dd HH:mm") | |
return format.format(date) | |
} | |
fun currentTimeToLong(): Long { | |
return System.currentTimeMillis() | |
} | |
fun convertDateToLong(date: String): Long { | |
val df = SimpleDateFormat("yyyy.MM.dd HH:mm") | |
return df.parse(date).time | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment