Hello Vladislav,
For this you have to manage it using Storage service. In which you can insert/update a json document to maintain the status of user when ever he/she login to app. And you can fetch the document based on the time field using order by clause.
Have a look at
this link for the code snippet & let us know if it helps.
Thanks
/sachin