Languages
[Edit]
EN

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

18 points
Created by:
Root-ssh
175460

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

Alternative titles

  1. Java - get current date and time of java.util.Date class
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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