一、警告代码:
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
二、警告内容:
原文:To get local formatting use getDateInstance(), getDateTimeInstance(), or getTimeInstance(), or use new SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates.
翻译:若要获取本地格式,请使用 getDateInstance()、getDateTimeInstance() 或 getTimeInstance(),或者使用新的 SimpleDataFormat(String template, Locale locale),例如将Locale.US用于ASCII日期。
三、警告描述:
使用 SimpleDateFormat(String pattern) 构造函数,这意味着使用默认语言环境,正如

这篇博客讨论了在Java中使用SimpleDateFormat时的警告,建议使用getDateInstance()、getDateTimeInstance()或getTimeInstance(),或指定Locale以避免依赖默认语言环境。提供了两种解决方案,包括使用带Locale参数的构造函数和使用DateFormat类的方法,并给出了相关API链接。
最低0.47元/天 解锁文章
4606

被折叠的 条评论
为什么被折叠?



