import java.util.Date;
import java.text.SimpleDateFormat;
public class NowString {
public static void main(String[] args) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
}
}
Date d = new Date();
import java.util.*;
public class Mydate{
public static void main(String[] args){
System.out.println(new Date());
}
}
package org.shao;
import java.util.Calendar;
public class Test1{
public static void main(String[] args) {
Calendar cld = Calendar.getInstance();
cld.add(Calendar.DATE, 0);
System.out.println(cld.getTime());
}
}