Код: Выделить всё
Fri Jun 28 10:00:01 GMT+01:00 2024Я пробовал следующее:
Код: Выделить всё
typealias Dates = java.util.Date
fun Dates.toEpochMillis(timeZoneId: ZoneId): Long {
val one = Instant.ofEpochMilli(time).toEpochMilli() // 1719565201000
val three = secsToMillis(this.toLocalDateTime(timeZoneId).utcEpochSecs) // 1719568801000
return one
}
fun Dates.toLocalDateTime(timeZoneId: ZoneId): LocalDateTime {
return Instant.ofEpochMilli(time).atZone(timeZoneId).toLocalDateTime()
}
fun secsToMillis(timeInSecs: Long): Long {
return timeInSecs * 1000
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... lliseconds