How can i display seconds ago/minutes ago/with unix timestamp?

后端 未结 3 1548
后悔当初
后悔当初 2021-01-26 08:13

I need the unix timestamp - the timestamp i have. Then display the time between like on twitter.

3条回答
  •  佛祖请我去吃肉
    2021-01-26 08:43

    If you have the difference called diff:

    $seconds = intval($diff) % 60;
    $minutes = intval($diff/60) % 60;
    $hours = intval($diff/3600) % 24;
    $days = intval($diff/(3600*24));
    

    Is this what you want ?

提交回复
热议问题