conventionschedule-android/app/src/main/java/com/adlerosn/brasilfurfest/helper/SimpleDateFormatters.kt

11 lines
605 B
Kotlin

package com.adlerosn.brasilfurfest.helper
import java.text.SimpleDateFormat
private fun getSimpleDateFormat(pattern: String) = SimpleDateFormat(pattern, resources.runtimeLanguage.locale)
fun Long.formatAsHoursAndMinutes() = getSimpleDateFormat("HH:mm").format(this)
fun Long.formatAsDayOfWeek() = getSimpleDateFormat("E").format(this)
fun Long.formatAsLongDayOfWeekWithNumber() = getSimpleDateFormat("EEEE (d)").format(this)
fun Long.formatAsDayOfWeekNumberNoParenthesis() = getSimpleDateFormat("E d").format(this)
fun Long.formatAsIso() = getSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(this)