字符串与时间戳的转化

1.    字符串转化为时间戳

         String s="2015-06-06 15:00:00";

   Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(s);
   lDate1 = date.getTime();
 
 
2.时间戳转化为字符串
   String s=null;
//date为时间戳
   s=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(date));
   

猜你喜欢

转载自blog.csdn.net/forzhers/article/details/52447192