Example usage for java.time LocalDateTime parse

List of usage examples for java.time LocalDateTime parse

Introduction

In this page you can find the example usage for java.time LocalDateTime parse.

Prototype

public static LocalDateTime parse(CharSequence text) 

Source Link

Document

Obtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30 .

Usage

From source file:org.ojbc.adapters.analyticsstaging.custody.processor.AbstractReportRepositoryProcessor.java

protected LocalDateTime parseLocalDateTime(String dateTimeString) {

    try {/*  ww  w. j ava 2  s  . co  m*/
        if (StringUtils.isNotBlank(dateTimeString)) {
            if (dateTimeString.length() > 19) {
                dateTimeString = dateTimeString.substring(0, 19);
            }
            return LocalDateTime.parse(dateTimeString);
        } else {
            log.error("The dateTimeString can not be blank");
        }
    } catch (DateTimeParseException e) {
        log.error("Failed to parse dateTimeString " + dateTimeString, e);
    }

    return null;
}