Q:

How to get current system date and time in Java?

belongs to collection: Java Date and Time Programs

0

How to get current system date and time in Java?

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Consider the program:

// Java program to get current system 
// date and time

//package to class Date class
import java.util.Date;

public class GetSystemDateTimePrg {
  public static void main(String args[]) {
    //creating object of Date class
    Date dt = new Date();
    //printing the date and time 
    System.out.print("Current system date and time is: " + dt.toString());
  }
}

Output

Current system date and time is: Mon Jul 13 20:56:09 IST 2015

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java Date and Time Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to print different dates of days like... >>
<< How to convert Date string to Date format in Java?...