Illegal pattern character 'Y' on Ubuntu

强颜欢笑 提交于 2019-11-29 09:24:12

I search for SimpleDateFormat and got the doc from oracle.

Works in my windows because I set the default JRE to 1.7 but still running using JRE1.6 for the Play Framework.

Works on Windows because of this, JRE1.7 has added 'Y' pattern for Week year and in JRE1.6 there is no pattern for this.

Y is not an valid pattern. y is.

As per the docs:

Letter   Date or Time Component     Presentation    Examples
G        Era designator             Text            AD
y        Year                       Year            1996; 96
M        Month in year              Month           July; Jul; 07
w        Week in year               Number          27
...

I don't know why Y would work in windows, but it is not documented. y is the correct one. And the safest.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!