Why is there an extra hour here!?! ```fun getTimer...
# android
m
Why is there an extra hour here!?!
Copy code
fun getTimer(): String {
    val timeElapsed = LocalDateTime.ofInstant(Instant.ofEpochMilli(0), ZoneId.of("Europe/Paris"))
    val formatter = DateTimeFormatter.ofPattern("HH:mm:ss.SSS").withZone(ZoneId.of("Europe/Paris"))
    return timeElapsed.format(formatter) //returns 01:00:00.000    //why 1 hour ???
}
b
Could it have to do with day light savings time and today?
✔️ 1
c
Because you create an Instant of 1970-01-01T000000.000 in UTC and then move it to a local date time of Paris that is 1 hour from UTC.
🙌 1
1
a
#kotlinx-datetime
m
Solved with: val timeElapsed = LocalDateTime.ofInstant(Instant.ofEpochMilli(timerMillis), ZoneId.of("UTC")) - Thx a lot