相关疑难解决方法(0)

SimpleDateFormat警告要获取本地格式,请使用getDateInstance(),getDateTimeInstance()或getTimeInstance(),

我需要担心这个警告吗?如果我忽略警告怎么办?
这是什么警告表示:
为了让本地格式使用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)

我觉得这是如图所示日期格式以正确的方式在这里.

java android simpledateformat

26
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

java ×1

simpledateformat ×1