What is the accepted way to replace java.util.Date(year,month,day)

前端 未结 3 1405
再見小時候
再見小時候 2020-12-15 16:25

I\'m trying to do something really simple, but starting to realize that dates in Java are a bit of minefield. All I want is to get passed groups of three ints ( a year, a m

3条回答
  •  悲&欢浪女
    2020-12-15 16:45

    LG's answer is valid but in general you should use Calendar for all your date operations and leave Date out of it unless your API requires it explicitly. In that case you can just convert it when passing it to the API.

提交回复
热议问题