Formatting date in java

前端 未结 5 1386
孤独总比滥情好
孤独总比滥情好 2021-01-26 07:04

I am trying to format date string ex. 2014-11-24T18:30:00.000Z to 2014-11-24 using this code below:

SimpleDateFormat dateFormat = new          


        
5条回答
  •  隐瞒了意图╮
    2021-01-26 07:34

    You need to give a date as the argument for format not a String. First create a SimpleDateFormat to parse the string to a date then give the date object to the other SimpleDateFormat to format the date.

提交回复
热议问题