目录

LocalDate atEndOfMonth()

描述 (Description)

java.time.YearMonth.atEndOfMonth()方法在月末返回LocalDate。

声明 (Declaration)

以下是java.time.YearMonth.atEndOfMonth()方法的声明。

public LocalDate atEndOfMonth()

返回值 (Return Value)

今年 - 月的最后一个有效日期,不为空。

例子 (Example)

以下示例显示了java.time.YearMonth.atEndOfMonth()方法的用法。

package com.iowiki;
import java.time.LocalDate;
import java.time.YearMonth;
public class YearMonthDemo {
   public static void main(String[] args) {
      YearMonth date = YearMonth.of(2015,12);
      LocalDate date1 = date.atEndOfMonth();
      System.out.println(date1);  
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

2015-12-31
↑回到顶部↑
WIKI教程 @2018