update LocalDateTime - Java java.time

Java examples for java.time:LocalDateTime

Description

update LocalDateTime

Demo Code


//package com.java2s;
import java.time.LocalDateTime;

public class Main {
    public static LocalDateTime updateTime(
            LocalDateTime lastLogParsedDateTime, String time) {
        String hour = time.substring(0, 2);
        String mins = time.substring(2, 4);
        int tmpHour = Integer.parseInt(hour);
        int tmpMins = Integer.parseInt(mins);

        return lastLogParsedDateTime.withHour(tmpHour).withMinute(tmpMins)
                .withSecond(0);//from  w ww  .  j ava  2  s.c o m
    }
}

Related Tutorials