Set Date in a single line

前端 未结 8 2192
一个人的身影
一个人的身影 2021-01-31 01:55

According to the Java API, the constructor Date(year, month, day) is deprecated. I know that I can replace it with the following code:

Calendar myCa         


        
8条回答
  •  灰色年华
    2021-01-31 02:30

    Date date = new DateTime(2014, 6, 20, 0, 0).toDate();
    

    DateTime is from Joda.org https://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html

提交回复
热议问题