For example:
try {
for(ISession session : Core.getActiveSessions()) {
IMendixObject user = session.getUser().getMendixObject();
if (user.getType().equals(YOURTYPE.getType())) {
user.setValue(getContext(), Member.MemberNames.LastOnline.toString(), new Date());
Core.commit(getContext(), user);
}
}
} catch (Exception e) {
Core.getLogger("Error").info("Error occured while trying to write LastOnline attribute: "+e.getMessage());
}
return true;
(note, the user.getType().equals might need to be an inheritance check depending on your situation)
Note that this approach might be up to 5 minutes + scheduled event interval minutes off. So if you need to know it exactly, you need another approach.