import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
//获取今天的日期
public static String getToday(){
Date date = Calendar.getInstance().getTime();
//转换的日期类
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d");
String today = dateFormat.format(date);
return today;
}
}
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
//获取今天的日期
public static String getToday(){
Date date = Calendar.getInstance().getTime();
//转换的日期类
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d");
String today = dateFormat.format(date);
return today;
}
}