I want to get a formatted Date in Java

前端 未结 5 1603
广开言路
广开言路 2021-01-24 23:48

I want to get a new Date object with a SimpleDateFormat applied to it. I would like to do something like:

SimpleDateFormat myFormat =         


        
5条回答
  •  爱一瞬间的悲伤
    2021-01-25 00:39

    Your question doesn't make sense. Formatting a date by definition means converting it to a string using a specific format. The Date object can stay as a Date object. It is only at the point where you wish to convert it to a String that you need to do any formatting.

提交回复
热议问题