import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SimpleDateFormat sf=new SimpleDateFormat("yyyyMMdd");
try {
Date date=sf.parse("20090125");
Calendar cl=Calendar.getInstance();
cl.setTime(date);
int year1=cl.get(Calendar.YEAR);
int day1= cl.get(Calendar.DAY_OF_YEAR );
Date date2=cl.getTime();
Calendar c2=Calendar.getInstance();
int year2=c2.get(Calendar.YEAR);
int day2= c2.get(Calendar.DAY_OF_YEAR);
System.out.println((year2-year1)*365+(day2-day1));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}