1

Given the following time stamp ...

2018-09-07T17:00:00+02:00

which corresponds to ..

UTC: 1536332400000 milliseconds

I like to calculate the amount of minutes of the day using the ThreeTen backport library:

val dateUtc = 1536332400000L
val offset = ZoneOffset.ofHours(2) // taken from the time stamp
val offsetDateTime = Instant.ofEpochMilli(dateUtc).atOffset(offset)
val minutes = offsetDateTime.get(ChronoField.MINUTE_OF_DAY)

Above works so far.
Is there a way to avoid defining the zone offset since the UTC milliseconds already implicitly the zone offset of 0?

Related

JJD
  • 50,076
  • 60
  • 203
  • 339

0 Answers0