'Android ZoneDateTime.withHour always sets hour to 8
So I am tring to schedule alarm at a particular time on current day using AlarmManager. To do that I am using ZoneDateTime to get current time and then updating it to the hour at which I need to set the alarm. But for some reason time.withHour is giving me 8pm or 8am no matter what hour I am passing to it. Am I doing something wrong here?
var time = ZonedDateTime.now() //getting current time at my timezone
time = time.withHour(22).withMinute(8).withSecond(0)
print(time) //getting 8am/8pm at my timezone
val timeMilis = time.toInstant().toEpochMilli()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
