fun LocalDateTime.toMillis(zone: ZoneId = ZoneId.systemDefault()) = atZone(zone)?.toInstant()?.toEpochMilli()fun LocalDateTime.toDate(zone: ZoneId = ZoneId.systemDefault()) = Date.from(atZone(zone)?.toInstant())fun LocalDate.atEndOfDay() = atTime(LocalTime.MAX);
If you are dealing with Firestore Timestamp
fun Timestamp.toLocalDateTime(zone: ZoneId = ZoneId.systemDefault()) = LocalDateTime.ofInstant( Instant.ofEpochMilli(seconds * 1000 + nanoseconds / 1000000), zone)fun LocalDateTime.toTimestamp(zone: ZoneId = ZoneId.systemDefault()): Timestamp { return Timestamp(toDate(zone))}