Java Date to LocalDateTime toLocalDateTime(String string)

Here you can find the source of toLocalDateTime(String string)

Description

to Local Date Time

License

Apache License

Declaration

public static LocalDateTime toLocalDateTime(String string) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

public class Main {
    public static final DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
            .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).appendLiteral("Z").toFormatter();

    public static LocalDateTime toLocalDateTime(String string) {
        if (string == null) {
            return null;
        }//from ww w .j a  v a  2  s  . com
        return LocalDateTime.parse(string, FORMATTER);
    }
}

Related

  1. toLocalDateTime(Date dateTime)
  2. toLocalDateTime(Date utilDate)
  3. toLocalDateTime(long timestamp)
  4. toLocalDateTime(String date, int time)
  5. toLocalDateTime(String dateValue, String timeValue)