Java Date 日期转换

package Demo3;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

import javax.xml.crypto.Data;

public class DemoText1 {

public static void main(String[] args) throws ParseException {

fun();

}

public static void fun() throws ParseException{

SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

Date date=sdf.parse("1995-08-27");

//转换为我们熟悉的日期格式

SimpleDateFormat sd=new SimpleDateFormat("yyyy年MM月dd日");

String fffsd=sd.format(date);

System.out.println(fffsd);

}

}