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


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

package com.codingdict;

import java.time.MonthDay;
import java.time.format.DateTimeFormatter;

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

      MonthDay date = MonthDay.parse("--12-30");
      System.out.println(date);  
      DateTimeFormatter formatter = DateTimeFormatter.ofPattern("--MM-dd");
      System.out.println(formatter.format(date));  
   }
}