1. Computing

Time Based PHP Greetings

By , About.com Guide

1 of 4

Getting the Current Time
Before we can greet the user based upon the time of day, we first need to find out what time of day it is.
 <?php 

$b = time();

$hour = date("g",$b); $m = date ("A", $b);

First we get the timestamp for the current date using the time () function. For the purpose of our script the only important parts are the hour and the AM/PM. We set a variable for each of these aspects of the time.
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Step By Steps
  5. Time Based Greetings - PHP Greeting Script

©2013 About.com. All rights reserved.