Java - Getting current time and date

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

Date currentDateAndTime = getDateTime();

Post a Comment

0 Comments