chi
12/07/2021, 8:07 PMLocalDateTime
or Instant
string parsing methods failMustafa Ozhan
12/07/2021, 9:52 PMfun Instant.toDateString(
timeZone: TimeZone = TimeZone.currentSystemDefault()
) = toLocalDateTime(timeZone).run {
"${hour.doubleDigits()}:${minute.doubleDigits()} " +
"${dayOfMonth.doubleDigits()}.${monthNumber.doubleDigits()}.${year.doubleDigits()}"
}
this one doesn’t fail to meMustafa Ozhan
12/07/2021, 9:53 PMprivate const val BIGGEST_DIGIT = 9
fun Int.doubleDigits() = if (this <= BIGGEST_DIGIT) "0$this" else "$this"
chi
12/08/2021, 2:47 PMLocalDateTime
, it'll throw an error