Get System Date and Time in Java

Below is a simple Java program to return the data and time of the current system that this code runs on.

More like this:

To get started, you will need to import the Date Utility library:

import java.util.Date;

Get current system date and time using Java

import java.util.Date;
public class GetCurrentDateTime 
    public static void main(String args[])
        Date date = new Date();
Fri Sep 24 02:53:01 GMT 2021

Happy coding!

Leave a Reply

Your email address will not be published.