Skip to Content

Calculate Site Uptime Using PHP

Supplying additional information to your website can be a nice statistics display. One of them is to make use of PHP to display the site uptime up to date.

It is quite easy to do so if you know a little bit about programming or (PHP programming).

(learn to use PHP to calculates site uptime...)

First of all, you need to have a PHP-enabled site in order to do this. You can use this in WordPress as well, but a runPHP plugin (for WordPress is required.

Source Code
<?php
  $createDate = "14-Feb-2008"; /* your start date here */
  $days = floor((time() - strtotime($createDate))/86400)+1;
  echo ("Website Creation Date: <b>$createDate</b><br />Website Uptime: <b>$days</b> days");
?>

The result from this code is shown below:

Website Creation Date: 14-Feb-2008
Website Uptime: 282 days

A few lines of code can simply illustrate a much more informative and statistical display on your website. So, why not try it?

Trackback URL for this post:

http://www.neohide.com/trackback/247

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options