How to get day of the month?

后端 未结 9 1702
南笙
南笙 2020-11-30 05:48

I am trying to retrieve which day of the month it is.

Such as today is August 29,2011.

What i would like to do is just get the days number such as 29, or 30.

9条回答
  •  佛祖请我去吃肉
    2020-11-30 06:03

    You could start by reading the documentation for Date. Then you realize that Date’s methods are all deprecated and turn to Calender instead.

    Calendar now = Calendar.getInstance();
    System.out.println(now.get(Calendar.DAY_OF_MONTH));
    

提交回复
热议问题