Skip to content

Tag: jsr310

Modifiying time in LocalTimeDate object

Given a LocalDateTime object in Java. How do I set the time for this to 00:00:00 ? One way is to create a new LocalDateTime object with the same date as this one and set it to 0. Is there another way to do it? Answer A given LocalDateTime object can not be modified, since those are immutable. But you

Why does the java.time.Clock has zone information?

Why does java.time.Clock has zone information? From the Clock you only can get an Instant when calling the instant() method – which is a time without zone info. Is the only purpose to have the zone available in the clock to e.g. create a ZonedDateTime like this? ZonedDateTime.ofInstant(clock().instant()…

Jackson deserialization issue for ZonedDateTime

I’ve the following field in a class I use during deserialization of a service that I’m consuming. The service I’m consuming may return a Date or DateTime using the pattern: yyyy-MM-dd’T’HH:mm:ss.SSSZ Let me give 2 examples of what the service returns: 2015-11-18T18:05:38.000+0200…