62,620
社区成员
发帖
与我相关
我的任务
分享
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
public class Test{
public static void main(String[] args) throws ParseException{
DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
GregorianCalendar gc=new GregorianCalendar(1000,1,29);
Date date=gc.getTime();
String sdate=dateFormat.format(date);
System.out.println(sdate);
}
}
public boolean isLeapYear(int year) {
if ((year & 3) != 0) {
return false;
}
if (year > gregorianCutoverYear) {
return (year%100 != 0) || (year%400 == 0); // Gregorian
}
if (year < gregorianCutoverYearJulian) {
return true; // Julian
}
boolean gregorian;
// If the given year is the Gregorian cutover year, we need to
// determine which calendar system to be applied to February in the year.
if (gregorianCutoverYear == gregorianCutoverYearJulian) {
BaseCalendar.Date d = getCalendarDate(gregorianCutoverDate); // Gregorian
gregorian = d.getMonth() < BaseCalendar.MARCH;
} else {
gregorian = year == gregorianCutoverYear;
}
return gregorian ? (year%100 != 0) || (year%400 == 0) : true;
}