How do I display a date with a custom timezone?

后端 未结 4 1203
感动是毒
感动是毒 2021-02-13 08:57

Lets say I have a string that represents a date that looks like this:

\"Wed Jul 08 17:08:48 GMT 2009\"

So I parse that string into a date object like this:

4条回答
  •  离开以前
    2021-02-13 09:49

    Using:

    formatter.setTimeZone(TimeZone.getTimeZone("US/Central"));
    

    outputs:

    Wed Jul 08 12:08:48 CDT 2009
    

    for the date in your example on my machine. That is after substituting zzz for ZZZ in the format string.

提交回复
热议问题