转换时间戳

1.当前时间转换为时间戳:new  data().getTime();


2.取String类型特定的时间转换时间戳:

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

 Date  f=format.parse(传过来的时间);//穿过来的时间转换为Date类型
Long long=(Long)f.getTime();//转化为Long类型的时间戳

 

 

posted @ 2020-08-14 19:51  Pseudo-lover  阅读(202)  评论(0)    收藏  举报