logo image

Java program to print present day



Following program shows you how to print present day. We can get present day using LocalDate.now().getDayOfMonth() in java.

package basics;

import java.time.LocalDate;

public class Basic13 {

	public static void main(String[] args) {

		LocalDate presentDate = LocalDate.now();
		int presentDay = presentDate.getDayOfMonth();

		System.out.println("Present day is: " + presentDay);

	}

}

Output:

Present day is: 18