如何显示秒前/分钟前/带有 unix 时间戳? [英] How can i display seconds ago/minutes ago/with unix timestamp?
本文介绍了如何显示秒前/分钟前/带有 unix 时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要 unix 时间戳 - 我拥有的时间戳.然后在推特上显示点赞之间的时间.
I need the unix timestamp - the timestamp i have. Then display the time between like on twitter.
推荐答案
如果你有差异叫做 diff:
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));
这是你想要的吗?
这篇关于如何显示秒前/分钟前/带有 unix 时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文