SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String start="2014-01-01 00:00:00";
long now = 0;
long times =0;
try {
now = times = sdf.parse(start).getTime();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println(times);
Date dNow=new Date(1389254798000L);
System.out.println("日期类型:"+dNow.getTime());
System.out.println("日期类型:"+dNow);
long sd=1389254798000L;
//1389211598000
//1389254798000
Date dat=new Date(sd);
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(dat);
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String sb=format.format(gc.getTime());
System.out.println(sb);
System.out.println("========^^^^^^^^^^^^^^^^^^^^======");
两种转换方式