Answers for "current date and time example java"

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
0

see date in java

import java.util.Date;

public class Main {
   public static void main(String[] args) {
    Date date = new Date(System.currentTimeMillis());
    System.out.println(date);
    }
}
Posted by: Guest on July-01-2021

Code answers related to "current date and time example java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language