Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对不起,如果标题令人困惑,我将解释:我正在制作一个应用程序,它注册用户的操作,将其作为字符串写入数据库(如,17JUL2014 17:45),然后,从第一个条目创建我必须测量 3 天,所以当这 3 天过去时,我会提示用户做某事。我将如何做到这一点?
您应该使用 Unix 时间并将其保存为long.
long
long time = System.currentTimeMillis();
3天差异:
boolean isThreeDaysDifference(long savedTime){ if(System.currentTimeMillis() - savedTime > 1000*3600*24*3) return true; return false; }
编辑更正了值