Java 8中取得年、月、日資訊
package com.shxt.demo02; import java.time.LocalDate; public class Demo02 { public static void main(String[] args) { LocalDate today = LocalDate.now(); int year = today.getYear(); int month = today.getMonthValue(); int day = today.getDayOfMonth(); System.out.println("year:"+year); System.out.println("month:"+month); System.out.println("day:"+day); } }
以上是Java8中如何取得年、月、日信息的詳細內容。更多資訊請關注PHP中文網其他相關文章!