Computer Science, asked by kkhush24pe7sga, 1 year ago

Which class can be used Instead of System.getCurrentTimeMillis() to get a date and time in Java 8

Answers

Answered by nitish8089
0
we can simply use Date class and object.

import java.util.Date;

public class Date{

public static void main (String...args){

Date ob=new Date();

System. out. println(ob);

}

}
Answered by probrainsme102
0

Answer:

java. text. DateFormat class

Explanation:

  • The java. text. DateFormat class can be used to get the required date and time at the time of coding in java.
  • It is a class and used to parse the date in the required format in the java code.
  • This is an abstract method to get the date and time in the code.
  • It works in the in depended mode.

#SPJ2

Similar questions