Languages
[Edit]
EN

Java - print current date and time

0 points
Created by:
Palusbug
515

In this article, we would like to show you how to print the current date and time in Java.

Quick solution:

 

Practical example

Edit

To print the current date and time in Java you need to:

  1. Create a new Date object without any arguments - this will assign the current date and time to the new object,
  2. use toString() method to print the new object.

Example code:

Output:

1
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