PHP/AJAX/Javascript Display website "age"

178

I would like to display my website age but as a live result (like a reverse countdown via AJAX or so). Right now I have a PHP script that looks like:

<?php
echo secondsToTime(time()-(1203234532)); # number = timestamp when website was created
function secondsToTime($seconds) {
$dtF = new DateTime("@0");
$dtT = new DateTime("@$seconds");
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
}
php>

Now the actual age is displayed everytime the website is reloaded but how can I make it live?

Greetings

People are also looking for solutions to the problem: PHP executes its script and then closes its window

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.