Example usage for org.joda.time LocalDate parse

List of usage examples for org.joda.time LocalDate parse

Introduction

In this page you can find the example usage for org.joda.time LocalDate parse.

Prototype

public static LocalDate parse(String str, DateTimeFormatter formatter) 

Source Link

Document

Parses a LocalDate from the specified string using a formatter.

Usage

From source file:PersonClass.Person.java

public int getAge() {
    LocalDate Date1 = LocalDate.parse(DOB, DateTimeFormat.forPattern("dd/MM/yyyy"));
    LocalDate now = new LocalDate();
    Years Age_1 = Years.yearsBetween(Date1, now);
    Age = Age_1.getYears();/*from   ww w  . j  a  v a2s.  c  o m*/
    return Age;
}

From source file:py.com.palermo.curriculolanacion.entities.Curriculo.java

public Integer getEdad() {
    if (anioNac != null && mesNac != null && diaNac != null) {
        LocalDate birthdate = LocalDate.parse(anioNac + "-" + mesNac + "-" + diaNac,
                DateTimeFormat.forPattern("yyyy-MM-dd"));

        LocalDate now = new LocalDate();
        Years age = Years.yearsBetween(birthdate, now);
        edad = age.getYears();//  ww  w  .j  ava2  s  . c o  m
    }
    return edad;
}