How to get day of the month?

后端 未结 9 1669
南笙
南笙 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 05:54

    LocalDate date = new Date(); date.lengthOfMonth()

    or

    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM-dd");

    DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("MMM");

    String stringDate = formatter.format(date);

    String month = monthFormatter.format(date);

提交回复
热议问题