How do you install a "count-up" timer in a Wordpress post?

This is driving me absolutely insane. I want to put a ticker, one that counts off the time elapsed since I first installed it, in a post on my blog. I've googled, to no avail. My blog is on wordpress.com, if that's any help. Where can I find a code, and how to I implement it?

1 Answer

Relevance
  • 10 years ago
    Favorite Answer

    If you assumed you installed Wordpress on May 11, 2010 9:30:15 am you can calculate and write out the time difference in php like this:

    1. <?php

    2. // Get current time

    3. $date1 = time();

    4. // Get the timestamp of 2010 May 11, 9:30:15 am

    5. $date2 = mktime(15,30,09,05,11,2010);

    6. // get the difference in seconds

    7. $dateDiff = $date1 - $date2;

    8. // convert to minutes

    9. $fullMinutes = round($dateDiff/(60));

    10. // write to page

    11. echo "Site has been up $fullMinutes minutes";

    12. ?>

Still have questions? Get your answers by asking now.