package com.liming.date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DateFormatTest {
public static void main(String[] args) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
System.out.println(sdf.format(new java.util.Date()));
System.out.println(Calendar.getInstance().get(Calendar.YEAR));
System.out.println(sdf.format(sdf.parse("9999年9月9日 9时99分9秒")));
}
}
网友评论