import java.util.*; public class Test { public static void main(String args[]) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(1991, 7, 7); long time_1 = calendar.getTimeInMillis(); calendar.set(2012, 8, 31); long time_2 = calendar.getTimeInMillis(); long space = (time_2 - time_1) / (1000 * 60 * 60 * 24); System.out.println("至今我活了大约 " + space + " 天"); } }