MonthDay now() method in Java with Examples Last Updated : 12 May, 2020 Comments Improve Suggest changes Like Article Like Report The now() method of the MonthDay class in Java is used to get the current month-day from the system clock in the default time-zone. Syntax: public static MonthDay now() Parameters: This method does not accept any parameter. Return value: This method returns the current month-day using the system clock and default time-zone. Below programs illustrate the now() method of MonthDay in Java: Program 1: Java // Java program to demonstrate // MonthDay.now() method import java.time.*; import java.time.temporal.*; public class GFG { public static void main(String[] args) { // apply now() method // of MonthDay class MonthDay result = MonthDay.now(); // print both month and day System.out.println("MonthDay: " + result); } } Output: MonthDay: --05-09 Program 2: Java // Java program to demonstrate // MonthDay.now() method import java.time.*; import java.time.temporal.*; public class GFG { public static void main(String[] args) { // apply now() method // of MonthDay class MonthDay result = MonthDay.now(); // print only month System.out.println("Month: " + result.getMonth()); } } Output: Month: MAY References: https://docs.oracle.com/javase/10/docs/api/java/time/MonthDay.html#now() Comment More infoAdvertise with us Next Article MonthDay query() method in Java with Examples P pp_pankaj Follow Improve Article Tags : Java Java-Functions Java-MonthDay Practice Tags : Java Similar Reads MonthDay with() Method in Java with Examples with(Month month) method of the MonthDay class used to alter the month-of-year of MonthDay object using month passed as a parameter and after that method returns the copy of altered MonthDay.If the day-of-month value is invalid for the specified month after altering operation, the day will be adjust 2 min read MonthDay with() Method in Java with Examples with(Month month) method of the MonthDay class used to alter the month-of-year of MonthDay object using month passed as a parameter and after that method returns the copy of altered MonthDay.If the day-of-month value is invalid for the specified month after altering operation, the day will be adjust 2 min read MonthDay now(Clock) method in Java with Examples The now(Clock clock) method of the MonthDay class in Java is used to get the current month-day from the specified clock. Syntax: public static MonthDay now(Clock clock) Parameters: This method accepts clock as parameter which represents the clock to use. Return value: This method returns the current 1 min read MonthDay now(ZoneId) method in Java with Examples The now(ZoneId zone) method of the MonthDay class in Java is used to get the current month-day from the system clock in the specified time-zone. Syntax: public static MonthDay now(ZoneId zone) Parameters: This method accepts ZoneId as parameter. Return value: This method returns the current month-da 1 min read MonthDay query() method in Java with Examples query() method of an MonthDay class used to query this MonthDay using the specified query as parameter.The TemporalQuery object passed as parameter define the logic to be used to obtain the result from this MonthDay. Syntax: public <R> R query(TemporalQuery<R> query) Parameters: This met 2 min read MonthDay query() method in Java with Examples query() method of an MonthDay class used to query this MonthDay using the specified query as parameter.The TemporalQuery object passed as parameter define the logic to be used to obtain the result from this MonthDay. Syntax: public <R> R query(TemporalQuery<R> query) Parameters: This met 2 min read Like