Java 更改日期格式

import java.util.*;
import java.text.*;

public class TestDateFormat {
    public  static void main(String[] args)
    {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日");
        
        try
        {
            Date d = sdf2.parse("2003年03月15日");
            System.out.println(sdf1.format(d));
        }catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
原文地址:https://www.cnblogs.com/tanglimei/p/6901924.html