简体   繁体   中英

Converting a timestamp to a relative date/time (e.g., “2 minutes ago”) and continuously updating it with Javascript

Does anybody know how did Facebook do that "time ago". I'm trying to do the same with PHP/Javascript

I think it works something like PHP renders timestamp in HTML and then Javascript continuously calculate the time ago; does anybody know any more info about this?

格式为“2分钟前”的时间戳示例

http://timeago.yarp.com/

This is a great jQuery plugin for it, and it explains the concept quite concisely.

这是另一个完全可定制的替代方案: https//github.com/layam/js_humanized_time_span

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM