How to get like online, online 2 min ago, online one week age in php



if person is login in database changing status as online and if logout that time i am changing status and current date and time is updating,

So my question is if person is logout 1 hour before i want to show online one hour ago like that one day…etc

so my database date time is: 2019-07-03 11:22:00 - assume this is logout time i want to show above content…,

any suggestions please…,