获取当前日期方法:
import java.text.SimpleDateFormat;
import java.util.Date;
public class demo {
public static void main(String[] args) {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
System.out.println(sf.format(date));
}
}
import java.text.SimpleDateFormat;
import java.util.Date;
public class demo {
public static void main(String[] args) {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
System.out.println(sf.format(date));
}
}