Example usage for java.time MonthDay from

List of usage examples for java.time MonthDay from

Introduction

In this page you can find the example usage for java.time MonthDay from.

Prototype

public static MonthDay from(TemporalAccessor temporal) 

Source Link

Document

Obtains an instance of MonthDay from a temporal object.

Usage

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.from(LocalDate.now());

    System.out.println(m);

}

From source file:Main.java

public static void main(String[] argv) {
    LocalDate dateOfBirth = LocalDate.now();
    MonthDay birthday = MonthDay.of(dateOfBirth.getMonth(), dateOfBirth.getDayOfMonth());
    MonthDay currentMonthDay = MonthDay.from(LocalDate.now());

    if (currentMonthDay.equals(birthday)) {
        System.out.println("Yes!!");
    } else {/*from   w  w  w  . j  a v a 2 s . c  o  m*/
        System.out.println("Sorry, today is not your birthday");
    }
}