SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates

后端 未结 3 1411
遥遥无期
遥遥无期 2021-01-31 07:48

Issue: Using SimpleDateFormat directly without an explicit locale Id: SimpleDateFormat

SimpleDateFormat format = new SimpleDateFormat(         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 07:58

    To remove the warning just add Locale.getDefault() as the second argument while instantiating the date format object. Eg.

     SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",
                        java.util.Locale.getDefault());
    

提交回复
热议问题