Example usage for java.time.format DateTimeFormatter parse

List of usage examples for java.time.format DateTimeFormatter parse

Introduction

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

Prototype

public TemporalAccessor parse(CharSequence text) 

Source Link

Document

Fully parses the text producing a temporal object.

Usage

From source file:org.talend.dataquality.statistics.datetime.DateTimePatternManager.java

private static String dateTimePatternReplace(Map<DateTimeFormatter, String> parsers, String value) {
    if (StringUtils.isEmpty(value)) {
        return StringUtils.EMPTY;
    }/*from  ww  w  .j a v a2 s  .c  o  m*/
    for (DateTimeFormatter formatter : parsers.keySet()) {
        try {
            if (formatter.parse(value) != null) {
                return parsers.get(formatter);
            }
        } catch (DateTimeParseException e) {
            // continue
        }
    }
    return value;

}