java获取日期年月信息
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
class test{
public static void main(String[] args) throws ParseException {
Date d = new SimpleDateFormat("yyyy-MM-dd").parse("2029-1-01 12:12:12");
String ym=d.getYear()+1900+""+( d.getMonth()<9?("0"+(d.getMonth()+1)): ( d.getMonth()+1 ));
System.out.println(ym);
}
}