Java - unparseable date, need format to match “GMT-0400”

后端 未结 2 1381
广开言路
广开言路 2021-01-14 18:45

I have the following Java:

DateFormat formatter = new SimpleDateFormat(
    \"EEE MMM dd yyyy HH:mm:ss zZ (zzzz)\", Locale.ENGLISH);
Calendar cal = Calendar.         


        
2条回答
  •  孤街浪徒
    2021-01-14 19:38

    For some reason GMT-0400 isnt' working, and UTC-0400 is working. You can replace GMT with UTC.

    Note that this part will be completely ignored - the timezone will be resolved from what's found in the brackets (at least on my machine, JDK 6)

提交回复
热议问题