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

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

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

SimpleDateFormat format = new SimpleDateFormat(         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 08:07

    Careful about getDefault though, as it might not be appropriate for all use-cases, especially machine-readable output. From the docs:

    The default locale is not appropriate for machine-readable output. The best choice there is usually Locale.US – this locale is guaranteed to be available on all devices, and the fact that it has no surprising special cases and is frequently used (especially for computer-computer communication) means that it tends to be the most efficient choice too.

提交回复
热议问题