Is there a way to output the current time/days?
I want to show how long a go some post is posted on instagram.
$post->created_time is the created time of the post (from the Instagram API). I tested this and it is working. Now I tried to output the current time and calculate the difference.
I know in Wordpress you can use “human_time_diff”
So I search for the not Wordpress option:
<div class="instafeed__datetime"><?= date_diff($date,$post->created_time) ?> a go</div>
I tried to combine it with:
<?php $date = date('m/d/Y h:i:s a', time()); ?>
<div class="instafeed__datetime"><?= date_diff(now(),new DateTime($post->created_time)) ?> a go</div>
But I got the error Call to undefined function now()
Do I have to make use of strftime? Or what am I doing wrong?
Thanks