January 02, 2016

Checking current time and date using a simple PHP code

PHP is widely used server-side scripting language. It is designed for use with HTML and can be embedded insides of an HTML page. PHP is one of the most popular language for web development and  its  main purpose is to make the web pages dynamic.

To create a PHP file you use as .php at the end to let the server interpret as PHP.

Let us write a simple lines of PHP code to check the Current Time, Month, Day and Date.

PHP CODE

<?php
  date_default_timezone_set("Asia/Calcutta");
  $time = date('h:i:sA');
  echo "<p><b>Current time : $time </b></p>";
  $today = date('F Y');
  echo "<p><b>Month : $today </b></p>";
  $today = date('d');
  echo "<p><b>Date : $today </b></p>";
  $today = date('l');
  echo "<p><b>Day : $today </b></p>";
   ?>


END...

No comments :

Post a Comment