Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Advice
0 votes
1 replies
93 views

Recently, when I was reading the documentation for the OffsetDateTime class in Java, I came across a passage I didn’t understand: It is intended that ZonedDateTime or Instant is used to model data in ...
Advice
0 votes
13 replies
6k views

I am trying to replace Joda datetime and interval methods with Java.time and also trying to specify explicitly timezone as Duser.timezone=America/Chicago. This my code fragment public void ...
Score of 2
0 answers
96 views

I have a spring boot webapp, which uses thymeleaf for html templating and as templating engine for emails sent by this webapp, too. In my email I want to use a LocalDateTime, which does not work. ...
Score of 4
1 answer
628 views

DateTimeFormatter Java 8 introduced a modern date and time API with new types like LocalDate available in java.time.* package. It also provided a new DateTimeFormatter class for formatting (generating ...
Score of 9
7 answers
1457 views

I need to iterate through the whole hours of an interval of a particular day. So given the time at one whole hour on the day in question, say, 01:00, how do I find the next whole hour? The next whole ...
Score of -1
3 answers
301 views

I'm currently migrating my codebase from Joda-Time to the java.time API (Java 8+). In one part of my application, I schedule tasks to run at a specific time either today or tomorrow, depending on ...
Score of 2
4 answers
261 views

In Java, I can easily truncate a temporal value (LocalTime, ZonedDateTime, etc.) to seconds, milliseconds, or any other value that has an existing ChronoUnit defined: LocalTime time = LocalTime.now(); ...
Score of 0
1 answer
134 views

I am working on replacing crnk with Spring Hateos Json APi . I was getting a exception for LocalDateTime so I have used @JsonSerialize(using = LocalDateTimeSerializer.class) @JsonDeserialize(using =...
Score of -1
1 answer
188 views

I'm updating my code to use java.time.format.DateTimeFormatter instead of java.text.SimpleDateFormat and now a test fails which didn't before. When I parse the String 2010-12-31 00:00:00 , which in my ...
Score of 4
3 answers
253 views

Both of these DateTimeFormatters are nearly identical, however only the second one throws an exception. Both of these patterns are valid as far as I can tell. Why does changing minWidth cause parsing ...
Score of 6
4 answers
262 views

I am trying to parse durationString= P10YT10M using java.time.Duration.parse() method, but it fails with "Text cannot be parsed to a Duration". try { String durationString = "...
Score of 5
1 answer
208 views

I have a string: String inputDate = "18-FEB-24 10.02.33.578000000 AM"; I am trying to read it back and format it in YYYY-MM-DD HH:mm:ss.SSSSSS. I tried the SimpleDateFormat as well as ...
Score of -4
2 answers
723 views

I have this Joda-Time date which I want to migrate to java.time.OffsetDateTime: import org.joda.time.DateTime; private DateTime createdDate; private String creationTime; ..... DateTimeFormatter dtf = ...
Score of 0
0 answers
45 views

I am converting a JSON to an object and it's giving me the following error: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type java.time.LocalDateTime not supported ...
Score of 0
1 answer
386 views

I have this java code: import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import java.util.Date; DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat....

15 30 50 per page
1
2 3 4 5
138