Answers for "java print current date and time with seconds"

4

How to get current date and time in java

// get current date and timein java using Calendar.getTime() method
import java.util.Calendar;
import java.util.Date;
public class UsingCalendarClass
{
   public static void main(String[] args)
   {
      Date date = Calendar.getInstance().getTime();
      System.out.println(date);
   }
}
Posted by: Guest on November-30-2020
1

java get current date without time

Date currentDate = new Date();
  SimpleDateFormat dateFormat= new SimpleDateFormat("dd/MMM/yyyy");
  String dateOnly = dateFormat.format(currentDate);
  dateTextView.setText(dateOnly);
Posted by: Guest on June-28-2020

Code answers related to "java print current date and time with seconds"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language