How to use predefined formatting tools to parse or format dates in Java 8
package com.shxt.demo02; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Demo17 { public static void main(String[] args) { String dayAfterTommorrow = "20180205"; LocalDate formatted = LocalDate.parse(dayAfterTommorrow, DateTimeFormatter.BASIC_ISO_DATE); System.out.println(dayAfterTommorrow+" 格式化后的日期为: "+formatted); } }
The above is the detailed content of How to use predefined formatting tools to parse or format dates in Java8. For more information, please follow other related articles on the PHP Chinese website!