Java LocalDateTime Create localDateTimeOf(final String value)

Here you can find the source of localDateTimeOf(final String value)

Description

Parse the given value as a local datetime.

License

Apache License

Parameter

Parameter Description
value the value

Return

the date/time instance

Declaration

public static LocalDateTime localDateTimeOf(final String value) 

Method Source Code

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

import java.time.LocalDateTime;

import java.time.format.DateTimeFormatter;

public class Main {
    /**/*w w w . j  a v a  2s.com*/
     * Parse the given value as a local datetime.
     *
     * @param value the value
     * @return the date/time instance
     */
    public static LocalDateTime localDateTimeOf(final String value) {
        try {
            return LocalDateTime.parse(value,
                    DateTimeFormatter.ISO_LOCAL_DATE_TIME);
        } catch (final Exception e) {
            return null;
        }
    }
}

Related

  1. getLocalDateTime(Date datetime, TimeZone timeZone)
  2. getLocalDateTimeFromEpochMilli(long epochMillis)
  3. getLocalDateTimeFromMillis(final long millis)
  4. getLocalDateTimeFromMillis(long millis)
  5. localDateTime(Date date, Clock clock)
  6. toLocalDateTime(java.util.Date d)
  7. toLocalDateTime(long systemMillis)