PHP库生成用户友好的相对时间戳

编程入门 行业动态 更新时间:2024-10-25 12:28:09
本文介绍了PHP库生成用户友好的相对时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一个PHP 库,可以生成用户友好的时间表示,例如两小时前,当时间戳为 time() - 2 * 3600 。

I'm looking for a PHP library that generates user-friendly representations of times - for example "two hours ago" when the timestamp is time() - 2 * 3600.

有几个现有的问题与答案和博客文章(, 2 , 3 ) ,但都只包含代码段 - 不能是我可以安装和升级的库。

There are several existing questions with answers and blog posts (1, 2, 3), but all only contain code snippets - not a library I can install and upgrade.

Django有一个,Python也有一个独立lib ,Javascript有几个( 1 , 2 , 3 ),PHP库在哪里?

Django has one, Python also has a standalone lib, Javascript has several (1, 2, 3), too - where is the PHP library?

图书馆应该具备以下内容:

A library should have the following things:

  • 文档
  • PEAR可安装
  • 定期发布
  • (可选) li>
  • documentation
  • PEAR installable
  • regular releases
  • (optional) translations
推荐答案

由于似乎没有图书馆,我自己做了一个它包含在PEAR中:

Since there didn't seem to be any library, I've made one myself and got it included in PEAR:

Date_HumanDiff , pear.php/package/Date_HumanDiff

代码位于 github/pear/Date_HumanDiff

更多推荐

PHP库生成用户友好的相对时间戳

本文发布于:2023-10-24 09:44:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523610.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:友好   时间   用户   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!