java.time.LocalDate.format() 方法示例


java.time.LocalDate.format() 方法示例

package com.codingdict;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class LocalDateDemo {
   public static void main(String[] args) {

      LocalDate date = LocalDate.parse("2017-02-03");
      System.out.println(date);  
      DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/YYYY");
      System.out.println(formatter.format(date));  
   }
}