PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Jonathan Discipulo   World Time Class for PHP 5   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: index.php
Class: World Time Class for PHP 5
Retrieve the current time from a NTP server
Author: By
Last change: updated sample file
Date: 12 years ago
Size: 592 bytes
 

Contents

Class file image Download
<?php

require_once('class.world.time.php');

$time = new WorldTime();
$time->setTimeZone( 0 );

if (
$time->query()) {
    echo
"<div style=font-family:Arial;font-size:12pt>";
    echo
"Time Server Host: <span style=color:#999>" . $time->getHost() . "</span><br />";
    echo
"Time Server Port: <span style=color:#999>" . $time->getPort() . "</span><br />";
    echo
"Result in epoch seconds: <span style=color:red>" . $time->getResult() . "</span><br />";
    echo
"Today's date (UTC): <span style=color:#999>" . date("M d Y, H:i:s", $time->getResult()) . "</span>";
    echo
"</div>";
}

?>