#How can I set new time if time is 00 00 00?

5 messages · Page 1 of 1 (latest)

untold lily
#

Hello my code is

DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; ```

how can I check so if the time in the date is 00:00:00, then i want to set the time in the date to 00:01:00, how can i do that? 

New to Java.
swift meadowBOT
#

Hey, @untold lily!
Please remember to /close this post once your question has been answered!

dense peak
#

It's hard to guess. No choice but giving the solution

#
if(dateTime.toLocalTime().equals(LocalTime.of(0, 0, 0))) {
    dateTime = dateTime.withMinute(1);
}