Today encountered a time format conversion of Dongdong, depressed half of the afternoon, but fortunately finally finished.
Originally wanted to take YYYY-MM-DD format, but how the whole is Greenwich mean.
Our project is to use the Struts framework, using Idv.getupdatetime (). toLocaleString () can get XXXX xx month xx days xx:xx:xx
Finally, it is found that the attribute definition in the IdV class is a date type, which results in Greenwich time when fetching data.
After you change the date type to a string type, you also modify all classes that use the IdV class method, because the control layer is the actual calling method, which is typically in the Factoryimpl or Bo class, Find a method to modify its properties. Use the Dateutil.millistosimpledatestring () method in the API to transform the data into the parameters of the set method to produce the YYYY-MM-DD format
It is important to note that in other classes it is not necessary to define the time attribute as a string or a date type, and the key is which time conversion method is used.
If your set method parameter is a date type, you can use as the parameter new date (Long.parselong ())
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service