Example usage for java.time MonthDay of

List of usage examples for java.time MonthDay of

Introduction

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

Prototype

public static MonthDay of(int month, int dayOfMonth) 

Source Link

Document

Obtains an instance of MonthDay .

Usage

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.of(1, 21);

    System.out.println(m);

}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.of(Month.MARCH, 21);

    System.out.println(m);

}

From source file:Main.java

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

    System.out.println(m.equals(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

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

    System.out.println(m.isAfter(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

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

    System.out.println(m.isBefore(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

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

    System.out.println(m.compareTo(MonthDay.of(Month.APRIL, 1)));

}

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 {/* ww w. j  a  v  a  2 s.c  om*/
        System.out.println("Sorry, today is not your birthday");
    }
}

From source file:Main.java

public static void main(String[] args) {
    Month month = Month.JULY;
    int dayOfMonth = 14;

    MonthDay jugIL = MonthDay.of(month, dayOfMonth);

    System.out.println(jugIL);/*from   w w w.  j  av a2 s.c  o  m*/
}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.isValidMonthDay(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    LocalDate l = y.atMonthDay(MonthDay.of(Month.JANUARY, 21));
    System.out.println(l);/*from   w  w  w  .  j  a v a 2s  . c  o  m*/

}