[HELP]Java time/date

TehByte

Active Members
How do I echo the time/date to a console with Java?

I want the format to be [dd-mm-yyyy ss:hh]

 

GhostSnyper

Active Members
Umm in java, you'd use the DateTime package...

Code:
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public abstract class Time {
   private String getDateTime() {
       DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
       Date date = new Date();
       return dateFormat.format(date);
   }
}
 
Top Bottom