Java LocalDate Calculate stringToLocalDate(String birthDate)

Here you can find the source of stringToLocalDate(String birthDate)

Description

string To Local Date

License

LGPL

Declaration

static LocalDate stringToLocalDate(String birthDate) 

Method Source Code

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

import java.time.LocalDate;

public class Main {
    static LocalDate stringToLocalDate(String birthDate) {

        if (birthDate.length() != 8) {
            throw new IllegalArgumentException("Birth date must be of form yyyyMMdd, i.e. eight characters long.");
        }//  w w  w  .  j  a va2 s  . c  o  m

        return LocalDate.of(Integer.parseInt(birthDate.substring(0, 4)),
                Integer.parseInt(birthDate.substring(4, 6)), Integer.parseInt(birthDate.substring(6, 8)));
    }
}

Related

  1. plusDays(LocalDate date, int daysToAdd)
  2. rebucketingArray(List targetDates, double[] rebucketedSensitivityAmounts, double sensitivityAmount, LocalDate sensitivityDate)
  3. roundDown(final LocalDate dateTime, final TemporalUnit temporalUnit, final int size)
  4. stream(LocalDate startInclusive, LocalDate endExclusive)
  5. stringDateToLocalDate(String day, String month, String year)
  6. subscriptionDeletionRequired(LocalDate vehicleMotExpiryDate, LocalDate requestDate)
  7. toMilliseconds(LocalDate localDate)
  8. toPgDays(LocalDate date)
  9. withinAYearFromNow(LocalDate date)