DateTimeFormat.forPattern 一个月不使用文本
DateTimeFormat.forPattern won't use text for month
据记载here,使用字符串 "MMM" 作为月份,使用的是文本而不是数字:
Month: 3 or over, use text, otherwise use number.
我正在做 DateTimeFormat.forPattern( "dd/MMM/yyyy" ).print( DateTime.now() )
而不是 returning 05/Apr/2016
,而是 returning 05/4/2016
.
如何将 return 月份设为文本格式?
Java 6
这解决了问题:
DateTimeFormat.forPattern( "dd/MMM/yyyy" ).withLocale( Locale.US ).print( DateTime.now() )
现在我得到 05/Apr/2016
据记载here,使用字符串 "MMM" 作为月份,使用的是文本而不是数字:
Month: 3 or over, use text, otherwise use number.
我正在做 DateTimeFormat.forPattern( "dd/MMM/yyyy" ).print( DateTime.now() )
而不是 returning 05/Apr/2016
,而是 returning 05/4/2016
.
如何将 return 月份设为文本格式?
Java 6
这解决了问题:
DateTimeFormat.forPattern( "dd/MMM/yyyy" ).withLocale( Locale.US ).print( DateTime.now() )
现在我得到 05/Apr/2016