Current time (now) in Kirby

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

is a MySQL function, not a PHP function. Use either date() or time().

Thanks. I think I am almost there.

<div class="instafeed__datetime"><?= date_diff(time(),new DateTime($post->created_time)) ?> a go</div>

DateTime::__construct(): Failed to parse time string (1589893993) at position 8 (9): Unexpected character

So I should convert it to readable stuff.

That function obviously expects two DateTime objects, see the PHP docs: https://www.php.net/manual/de/datetime.diff.php