开发者

Getting the relative date from a Timestamp (i.e. Today, Tomorrow)

开发者 https://www.devze.com 2023-03-26 11:35 出处:网络
I was wondering if PHP has a built in function to return the relevance of a date. For example: $timestamp = time();

I was wondering if PHP has a built in function to return the relevance of a date. For example:

$timestamp = time();
$other = time()+86400;

echo rel_date($times开发者_Python百科tamp); //prints Today
echo rel_date($other); //prints Tomorrow

I know it's pretty simple functionality to build but I don't want to be reinventing the wheel!


As far as I know there is no built in function that has a format option which ouputs "Today", "Yesterday", "Tomorrow", etc..

I've made them myself because of this anyway. It seems you'll need to build it yourself after all, sorry :(

0

精彩评论

暂无评论...
验证码 换一张
取 消