Java Date Time Java Java API
Class:
java.time.MonthDay
Methods:
public static MonthDay of(Month month,
int dayOfMonth)
This method creates an instance of MonthDay for the provided month enum and dayOfMonth value. The specified dayOfMonth must be a valid day for a month.
public static MonthDay of(int month,
int dayOfMonth)
This method creates an instance of MonthDay for the provided month and dayOfMonth values. The specified month and dayOfMonth values must be valid for a month and the day within that month.
Examples
package com.logicbig.example.monthday;
import java.time.Month; import java.time.MonthDay;
public class OfExample {
public static void main(String... args) { MonthDay m = MonthDay.of(Month.SEPTEMBER, 10); System.out.println(m); } }
Output--09-10
package com.logicbig.example.monthday;
import java.time.MonthDay;
public class OfExample2 {
public static void main(String... args) { MonthDay m = MonthDay.of(10, 6); System.out.println(m); } }
Output--10-06
|