Java Time Zone When Parsing DateFormat

后端 未结 7 1670
梦谈多话
梦谈多话 2020-12-06 17:20

I had code that parses date as follows:

String ALT_DATE_TIME_FORMAT = \"yyyy-MM-dd\'T\'HH:mm:ss.SSSZ\";
SimpleDateFormat sdf = new SimpleDateFormat(
                 


        
7条回答
  •  伪装坚强ぢ
    2020-12-06 17:41

    Try to change it to lower case z.

    z processes most of the common general timezone syntax, while Z uses stricter RFC 822 time zone with 4 digits.

    Although its documented that both should parse 'General timezone settings', it might make the difference in your case.

提交回复
热议问题