PHPEveryday.com PHP and Web Development Tutorial
What are you looking for?


PHP Time: Showing Server Date and Time Using PHP and JavaScript


PHP Time Tutorial: In this post, we will learn how to show server date and time to browser. May we want to synchronize server and client time. It is applied for real time application like for forex web application and so on.

For this job, we need help from servertime class. You can get this class from http://www.ingoknito.de. Please download.

After download, place inc_servertime.php within directory www/test/servertime. Then create a file named "test.php". Enter following code:

 <html>
 <head>
 <?
 include 'inc_servertime.php';
 $st = new servertime;
 $st->lang = 'english'; 
 $st->shortmonth = true;
 
 $st->InstallClockHead();
 
 ?>
 </head>
 <body>
 <?
 $st->title = 'Our server: ';
 
 $st->InstallClock();
 $st->InstallClockBody();
 ?>
 
 </body>
 </html>

Point your browser to http://localhost/test/servertime/test.php.





Tag: date, time, server time, javascript Category: PHP Classes Post : January 03rd 2008 Read: 2,726 Bookmark and Share

blog comments powered by Disqus

Database Tutorial
  • Learn PHP MySQL
  • Learn PHP ADOdb
  • Learn PHP Data Object/PDO
  • Learn PHP XML
  • Learn PHP SimpleXML
Security Tutorial
  • Learn PHP Security
  • Learn HTTP Authentication
  • Learn PHPSecureSite
Framework Tutorial
  • Learn CodeIgniter
  • Learn Joomla
  • Learn Smarty
  • Learn Zend Framework
Template Tutorial
  • Learn Joomla Template
  • Learn WordPress Template
API Tutorial
  • Learn Facebook
JS Framework Tutorial
  • Learn MooTools
  • Learn JQuery
AJAX Tutorial
  • Learn AJAX in 10 Minutes
  • Learn AJAX Client Side
  • Learn AJAX PHP
  • Learn AJAX Remote Server
  • Learn AJAX Repetitive
  • Learn AJAX MySQL
  • Learn AJAX Grid
Web Services Tutorial
  • Learn Web Services NuSOAP
  • Learn Web Services WSDL
  • Learn Web Services WSDL Array
  • Learn Web Services .NET Grid
  • Learn Web Services WDDX
Package Post
  • Joomla Intro
  • Joomla Component
  • Joomla Module
  • Joomla MVC
  • Joomla MVC Backend
  • PostNuke Intro
  • Zend Framework Intro
  • Zend Framework Action
  • Zend Framework Database
  • Zend Framework Registry
  • Zend Framework Config
  • Zend Framework Login
  • Zend Framework Session
  • PHP Array Tips
  • PHP File Tips
  • PHP Email
  • PHP Ms Excel
  • PHP Pattern
  • PHP SMS
  • Flash Database
  • PHP Multitier
  • jQuery Introduction
  • jQuery Selectors
  • Portable Web Server
  • Web Mobile Intro
  • Drupal Installation
  • Drupal Configuration