Languages
[Edit]
EN

Java - get current date of java.util.Date class

18 points
Created by:
Root-ssh
116000

In this short article, we would like to show how to get the current date and time of java.util.Date class.

Quick solution:

// import java.util.Date;

Date now = new Date();
System.out.println(now.toString());  // Wed Aug 11 16:11:42 CEST 2021

 

Practical example

import java.util.Date;

public class Program {

    public static void main(String[] args) {

        Date now = new Date();
        System.out.println(now.toString());  // Wed Aug 11 16:11:42 CEST 2021
    }
}

Example output:

Wed Aug 11 16:11:42 CEST 2021
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join