I want to add Date and Time to my Java Program , How can i get the system time and date and pass to Java program ?
import java.text.SimpleDateFormat;
import java.util.Date;
...
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(new Date()));
*Or* when you are only interested in the system date and time in ms: long sysTimeMs = System.currentTimeMillis();
JW