jean
02/14/2022, 2:20 PMClock.System.now()
.minus(1, DateTimeUnit.DAY, TimeZone.of(timeZoneId))
I just realized that now
is also relative to my personal timezone, isn’t? I could ask for the now value of japan for example, which is way different that mine. So why doesn’t now
take a Timezone parameter? Or did I miss something?Dmitry Khalanskiy [JB]
02/14/2022, 2:22 PMnow
returns an Instant
, which is timezone-independent and is the same for you and Japan.jean
02/14/2022, 2:46 PMminus
et plus
cares about the time zone then since it also returns an instant? It’s weird to me that I need to specify the timezone on the operation but not on the starting pointjean
02/14/2022, 2:47 PMDesmond van der Meer
02/14/2022, 2:52 PMDesmond van der Meer
02/14/2022, 2:53 PMDmitry Khalanskiy [JB]
02/14/2022, 2:54 PMLocalDateTime
arithmetic (exactly because it would be possible to use it without a time zone).Dmitry Khalanskiy [JB]
02/14/2022, 2:55 PMDesmond van der Meer
02/14/2022, 2:56 PMLocalDate
🙂Dmitry Khalanskiy [JB]
02/14/2022, 2:59 PMClock.System.now().toLocalDateTime(timeZone).date.minus(1, DateTimeUnit.DAY)
also allows knowing what day it was yesterday.ilya.gorbunov
02/14/2022, 3:13 PMClock.System.todayAt(timeZone)
might be of use.jean
02/14/2022, 3:38 PMplus
and minus
which make much more sense to me now hehe. I did not see this was available Instant.minus(value: Long, unit: DateTimeUnit.TimeBased)
Thanks for the clarifications 🙂Desmond van der Meer
02/14/2022, 3:41 PMjean
02/14/2022, 3:42 PM