For example, I want to parse the string below:
Tue Sep 28 18:02:24 GMT+08:00 2010
And I use the pattern for the SimpleDateFormat
:
new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzzzzzzz yyyy");
But I keep getting the ParseException
. How to fix this?
Thanks a lot.
使用一个Z,作为例子在这里
new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
Alright, I found the solution here.
new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
But what's the difference between using 'z' and 'Z' here? Are they the same?
即使您有很多z,它也可以工作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.