Skip to content

Commit

Permalink
feat(timeUtils): Long to Time String
Browse files Browse the repository at this point in the history
  • Loading branch information
Adolar0042 committed Jan 18, 2024
1 parent 9a3aefe commit d49e3ed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/java/com/chouten/app/common/TimeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@ fun epochMillisToTime(epochMilli: Long, pattern: String = "HH:mm:ss"): String {
timeZone = userTimeZone
}.format(Date(epochMilli))
}
}

/**
* Converts epoch milliseconds to a formatted time string.
*
* @param epochMilli The epoch time in milliseconds.
* @param pattern The desired pattern for formatting the time (default is "h:mm:ss").
* @return The formatted time string of [epochMilli] in the pattern of [pattern].
*/
fun Long.toTimeString(pattern: String = "HH:mm:ss"): String {
return epochMillisToTime(this, pattern)
}

0 comments on commit d49e3ed

Please sign in to comment.