I’m calculating the inactive interval of a particular user using the following code:
inActiveInterval = System.currentTimeMillis() - objHttpSession.getLastAccessTime();
Will this give the correct difference to the last access time if the session is having yesterday’s time?
Yes, this is correct. According to the API of
HttpSession.getLastAccessedTime():Which is consistent with
System.currentTimeMillis():You can also use:
as
Date.getTime()has the same meaning: