計算小時數差

//求今天剩下小時數
  java.sql.Timestamp nowtime=new Timestamp(System.currentTimeMillis());
  java.util.Date date2=formatter.parse(nowtime.toString());
  java.sql.Timestamp nowtime1= new Timestamp(date2.getTime());
  double nowDiffer=24-(double)(nowtime.getTime()-nowtime1.getTime())/3600000;

 

發佈了18 篇原創文章 · 獲贊 0 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章