Java LocalDate from String getLocalDateForString(final String string)

Here you can find the source of getLocalDateForString(final String string)

Description

get Local Date For String

License

Open Source License

Parameter

Parameter Description
string Datum-Wert

Return

-Objekt mit entsprechendem Datum-Wert

Declaration

public static LocalDate getLocalDateForString(final String string) 

Method Source Code


//package com.java2s;
/*//from w  w w .j a va 2  s . co  m
 * Copyright 2014-2015 Christian Raue
 * MIT License http://opensource.org/licenses/mit-license.php
 */

import java.time.LocalDate;

import java.time.format.DateTimeFormatter;

public class Main {
    private static final String PATTERN_DATE = "dd.MM.yyyy";

    /**
     * @param string Datum-Wert
     * @return {@link LocalDate}-Objekt mit entsprechendem Datum-Wert
     */
    public static LocalDate getLocalDateForString(final String string) {
        return LocalDate.parse(string, DateTimeFormatter.ofPattern(PATTERN_DATE));
    }
}

Related

  1. getLocalDateFromString(String sDate)
  2. parseLocalDate(String dateString)
  3. parseLocalDate(String inPattern, String inDate)
  4. parseLocalDate(String localDate)