long time=new Date().getTime();
System.out.println(""+time);
Date date=new Date(time);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(sdf.format(date));
public class Test19 {
public static void main(String[] args) {
// assert args.length==1;
int year, month, date, hour, minute, second;
Calendar now = Calendar.getInstance();
now = Calendar.getInstance();
year = now.get(Calendar.YEAR);
month = now.get(Calendar.MONTH);
date = now.get(Calendar.DATE);
hour = now.get(Calendar.HOUR_OF_DAY);
minute = now.get(Calendar.MINUTE);
second = now.get(Calendar.SECOND);
}
}