Answer the question
In order to leave comments, you need to log in
How to make a date like in VK?
How to make the date display like in VK?
I do it like this:
$visit = time() - $request['response']["items"][$i]["date"];
if($visit < 60) { $date_post = $visit . ' сек. назад'; }
elseif($visit < 3600) { $date_post = round($visit / 60) . ' мин. назад'; }
elseif($visit < 86400) { $date_post = round($visit / 3600) . ' ч. назад'; }
else { $date_post = date("d-m-Y H:i", $request['response']["items"][$i]["date"]); }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question