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

前端 未结 3 1404
再見小時候
再見小時候 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:46

    Well, you can use the deprecated constructor. It has been deprecated for over 13 years and still works - it isn't going anywhere. If you don't want to do that and don't want to use a third party library, you have to use Calendar.

    In Java 7, hopefully there will be a new time API, and you won't have the need for a third party API anymore.

提交回复
热议问题