obj.date
是一个 unix 时间戳(长)。我检查了日期是否正确,但我无法获得两个日期对象之间的分钟差。例如,当我期望接近 30 时,我得到 4。这是为什么呢?
Date now = new Date();
Date then = new Date((long)obj.date*1000);
int secondsbetweendates = (int) ((then.getTime()-now.getTime())/1000);
int minutesbetweendates = (secondsbetweendates/1000) % 60;