Java program to get current date and time


Program
import java.time.LocalDateTime; public class GetCurrentDateTime { public static void main(String[] args) { LocalDateTime datetime = LocalDateTime.now(); System.out.println("Current Date and Time is: " + datetime); } }
Input
Output