package ch07_12;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SimpleDateFormatTest {
	public static void main(String[] args) {
		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
		SimpleDateFormat sdf2 = new SimpleDateFormat("yy/MM/dd HH:mm");
		SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd");
		Date now = new Date();
		System.out.println("输出格式1："+sdf1.format(now));
		System.out.println("输出格式2："+sdf2.format(now));
		System.out.println("输出格式3："+sdf3.format(now));
		String s = "2014-09-15";
		Date date;
		try {
			date = sdf3.parse(s);
			System.out.println("输出格式4："+date);
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
}