Categories
date java

print current date in java with example

print current date in java with example

In this post we will learn to print current date in java with examples
Here we used Date.java from java.util package
In this example the time zone will be your default system time zone

Example

import java.util.Date;

public class DateExample {
	   
	public static void main(String[] args) {
          Date date = new Date();
          System.out.println("Current Date : " + date);
     }
}

Output

Current Date : Mon Dec 23 21:35:59 IST 2019
Reference

https://beginnersbug.com/add-3-days-to-the-current-date-in-java/

https://github.com/rkumar9090/BeginnersBug/blob/master/BegineersBug/src/com/geeks/example/DateExample.java

Leave a Reply

Your email address will not be published. Required fields are marked *