mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-19 20:48:08 +00:00
Updated time formatter
This commit is contained in:
parent
a29777eebc
commit
ed1cf58fd4
1 changed files with 1 additions and 10 deletions
|
|
@ -27,7 +27,6 @@ import java.util.Calendar
|
|||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
|
||||
class TimestampUtils {
|
||||
|
|
@ -148,17 +147,9 @@ class TimestampUtils {
|
|||
|
||||
@AnyThread
|
||||
fun timeToString(time: Long, timestampInSecs: Boolean = true): String {
|
||||
val use24hFormat = android.text.format.DateFormat.is24HourFormat(
|
||||
coreContext.context
|
||||
)
|
||||
val calendar = getCalendar()
|
||||
calendar.timeInMillis = if (timestampInSecs) time * 1000 else time
|
||||
|
||||
return if (use24hFormat) {
|
||||
SimpleDateFormat("HH'h'mm", Locale.getDefault()).format(calendar.time)
|
||||
} else {
|
||||
SimpleDateFormat("h:mm a", Locale.getDefault()).format(calendar.time)
|
||||
}
|
||||
return DateFormat.getTimeInstance(DateFormat.SHORT).format(calendar.time)
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue