SimpleDateFormat with TimeZone

前端 未结 6 872
旧巷少年郎
旧巷少年郎 2020-12-06 00:56

I\'m trying to format date from java.util.Date. I need this format:

2016-06-10T13:38:13.687+02:00.

How correctly convert this from standard Da

6条回答
  •  無奈伤痛
    2020-12-06 01:44

    You have add (ZZZZZ) at the end to get this format like below

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss ZZZZZ", Locale.getDefault());
    

提交回复
热议问题