2
可能重複之間:
How to calculate the difference between two Java java.sql.Timestamps?計算年,月,日差時間戳
你如何計算有多少間年/月/日(並不真正需要的時間)您從Java中的SQL中獲取兩個時間戳?
下面是我使用的代碼的片段:
query = "SELECT bc.periodbeginningdate " +
"FROM cus_billingcontract bc " +
"WHERE cus_billingcontract_id = " + recordID;
Timestamp bDate = DB.getSQLValueTS(null, query);
query = "SELECT bc.periodenddate " +
"FROM cus_billingcontract bc " +
"WHERE cus_billingcontract_id = " + recordID;
Timestamp eDate = DB.getSQLValueTS(null, query);
+1 JodaTime – MadProgrammer