我正在尝试代码
Date today = new Date();
Date todayWithZeroTime;
{
try {
todayWithZeroTime = formatter.parse(formatter.format(today));
} catch (ParseException e) {
e.printStackTrace();
}
}
String date = todayWithZeroTime.toString();
Run Code Online (Sandbox Code Playgroud)
它给出了输出:- Wed Dec 11 00:00:00 IST 2019 where I want 11/12/2019 其中 11/12/2019 是今天的日期