我有一個長的數據成員,表示一個日期。
我將它轉換爲一個java - 如何比較相同的日期
Date d = new Date(long);
我想現在如果一個諾特爾日期一直是同一天。 我該怎麼做? 謝謝。
(安德魯)
編輯:
在這裏找到這個解決方案
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
return fmt.format(date1).equals(fmt.format(date2));
Comparing two java.util.Dates to see if they are in the same day 看起來不錯
這個答案會幫助你,http://stackoverflow.com/a/2517954/2939690 – vuhung3990