Hi with the use of Util.Calendar you can get the current Date and Time. Below is the code sample.
import java.util.Calendar;
import java.text.SimpleDateFormat;
public class DateUtils {
public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
public static String now() {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
}
public static void main(String arg[]) {
System.out.println("Now : " + DateUtils.now());
}
}
use the below link to know more details
http://www.javafaq.nu/java-example-code-288.htmlhttp://www.rgagnon.com/javadetails/java-0106.html