Advertisement
Guest User

Untitled

a guest
Mar 24th, 2021
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.32 KB | None | 0 0
  1. fun getDeviceStartOfCurrentDay(): Long {
  2.     val zoneId = ZoneId.systemDefault()
  3.     val midnight = LocalTime.MIN
  4.     val today: LocalDate = LocalDate.now(zoneId)
  5.     val todayMidnight: LocalDateTime = LocalDateTime.of(today, midnight)
  6.     val zdt = todayMidnight.atZone(zoneId)
  7.  
  8.     return zdt.toEpochSecond() * 1000
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement