我们应该在java中使用de java.util.Date对象吗?它有很多Deprecated方法,有点麻烦,必须使用复杂的方法来做一些应该这么简单的事情.
我正在使用一些愚蠢的东西模仿getDate(),如:
public static int toDayMonth (Date dt)
{
DateFormat df = new SimpleDateFormat("dd");
String day = df.format(dt);
return Integer.parseInt(day);
}
Run Code Online (Sandbox Code Playgroud)
它必须是更好的方式......