distance_of_time_in_words(strtotime(2010-08-07), strtotime(2010-08-01))返回“6分钟”
$a = '2010-08-02 00:39:29'
$b = '2010-08-01'
distance_of_time_in_words($a, $b)返回‘少于一分钟’
$a = '2010-08-02 00:39:29'
$b = '2010-08-01 20:08:00'
distance_of_time_in_words($a, $b)返回‘少于一分钟’
我想知道我是不是在转换过程中出错了..它接受时间戳或日期吗?谢谢
发布于 2010-08-02 11:36:29
// call
distance_of_time_in_words(getUnixTimestamp(), getUnixTimestamp($bill->created_at));
// utility method
public function getUnixTimestamp($datetime = null)
{
return date("U", (($datetime) ? strtotime($datetime) : time()));
}希望这能帮助其他人!
发布于 2010-08-02 05:28:36
检查它的source code,它似乎需要时间戳(它在函数开始时进行一些计算)。
https://stackoverflow.com/questions/3383373
复制相似问题