android时间格式的转化,String,Date,long

long time=System.currentTimeMillis(); 

System.out.println(time);

SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  

java.util.Date d1=new Date(time);  

String now=format.format(d1); 

System.out.println(now);

long t = 0;

try {

java.util.Date d2 = format.parse(now);

t = d2.getTime();

} catch (ParseException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

System.out.println(t);