After the Java date is installed as an English string, the solution to date cannot be switched back

This is a problem encountered by colleagues.

The date in the code is placed on the page in the format of "fri Mar 21 09:20:38 CST 2014" (not displayed, only for passing to the next controller),

When submitting the form again, the private date starttime of the dto class; Not set into value.

Did an experiment with a local program

Program execution format Parse (nowstr) reports an error

Java. text. ParseException: Unparseable date: "Fri Mar 21 09:25:48 CST 2014"

at java. text. DateFormat. parse(DateFormat.java:337)

After analyzing and viewing the source code, it is concluded that the error is caused by the language used by the system.

The default is

Where system Getproperty ("user. Language") is zh because the system is Chinese. It should be Chinese. The time zone does not support this format.

Modify the above code to verify this view

Another solution is to convert the date format once in the JSP page, such as

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>