- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to Get Current Date/Time
This is a very easy method to get current date and time in Java. You can use a simple Date object with toString() method to print the current date and time as follows −
Example
import java.util.Date; public class DateDemo { public static void main(String args[]) { // Instantiate a Date object Date date = new Date(); // display time and date using toString() System.out.println(date.toString()); } }
Output
Sun Apr 22 19:07:56 UTC 2018
- Related Articles
- Java Program to Display current Date and Time
- How to get the current date and time in Java?
- How to get current date/time in milli seconds in Java?
- Java Program to get current date, year and month
- Get current date/time in seconds - JavaScript?
- Get current time and date on Android
- How to get current time and date in C++?
- How to get current date and time in Python?
- How to get current date and time in JavaScript?
- How to get current date and time using JavaScript?
- How to get current date/time in seconds in JavaScript?
- C++ Program to print current Day, Date and Time
- How to get the current date in Java?
- How to get current date and time from internet in iOS?
- How to get current date and time from internet in android?

Advertisements