我需要担心这个警告吗?如果我忽略警告怎么办?
这是什么警告表示:
为了让本地格式使用getDateInstance(),getDateTimeInstance()或者getTimeInstance(),也可以使用new SimpleDateFormat(String template, Locale locale)具有例如Locale.US用于ASCII日期.
在下面的代码的第二行.该应用程序与代码正常工作.我想显示日期,例如19 Nov 2014.
public static String getFormattedDate(long calendarTimeInMilliseconds) {
SimpleDateFormat sdfDate = new SimpleDateFormat("d MMM yyyy"); //ON THIS LINE
Date now = new Date();
now.setTime(calendarTimeInMilliseconds);
String strDate = sdfDate.format(now);
return strDate;
}
Run Code Online (Sandbox Code Playgroud)
我觉得这是如图所示日期格式以正确的方式在这里.