How to convert “Fri Sep 21 15:23:59 CEST 2012” to “2012-09-21T15:23:59” in Java?

后端 未结 3 1234
攒了一身酷
攒了一身酷 2020-12-21 06:30

I want to convert the date string \"Fri Sep 21 15:23:59 CEST 2012\" to \"2012-09-21T15:23:59\" in Java. I tried this with SimpleDateFormat and the following code:

         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-21 07:21

    You can use:

    SimpleDateFormat input = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
    

提交回复
热议问题