Date date=new Date();
System.out.println(date.getTime()); //获取当前时间戳
Long timeLong=1418438884773L;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String sd = sdf.format(new Date(timeLong)); //把时间戳转为日期
System.out.println(sd);
System.out.println(date.getTime()); //获取当前时间戳
Long timeLong=1418438884773L;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String sd = sdf.format(new Date(timeLong)); //把时间戳转为日期
System.out.println(sd);