import java.text.DateFormat;
import java.text.ParseException;import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Scanner;
public class Zuo {
static Zuo z=new Zuo();
static Scanner sc=new Scanner(System.in);
public void di1() throws ParseException{
System.out.println("请输入第一个天数");
String day1=sc.next();
System.out.println("请输入第二个天数");
String day2=sc.next();
DateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=new GregorianCalendar();
Date d11=df.parse(day1);
Date d22=df.parse(day2);
int cha=(int) ((d22.getTime()-d11.getTime())/(60*60*1000*24));
System.out.println(cha);
}
public void di2() throws ParseException{
System.out.println("请输入一个毫秒");
// long miao=24*60*60*1000;
long miao=sc.nextLong();
SimpleDateFormat format=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
System.out.println(new Date(0));
System.out.println(format.format(new Date(miao)));
System.out.println(format.format(new Date()));
Date xian=new Date();
Calendar cal = Calendar.getInstance();
Calendar ca = Calendar.getInstance();
cal.setTime(xian);
ca.setTime(xian);
cal.add(Calendar.DATE, 40);
System.out.println("四十天后的日期:"+format.format(cal.getTime()));
DateFormat df=new SimpleDateFormat("yyyy-MM-dd");
System.out.println("输入一个日期");
String shu=sc.next();
Date d44=df.parse(df.format(ca.getTime()));
Date d33=df.parse(shu);
System.out.println(shu+"距离今天"+(d33.getTime()-d44.getTime())/(60*60*1000*24)+"天");
}
public static void main(String[] args) throws ParseException {
// TODO Auto-generated method stub
// z.di1();
z.di2();
}
}