About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Date...

   Browse by title articles:
   What is hot:

Date

File Permissions

File Open and Close

Creating Directories

Email - Basics

Email - Multiple Recipients

Frames - Good or bad?
The Basic Uses of SSI
See How To Troubleshoot Your Power Supply
Storage and re-use of images using PHP/GD - Part II
Prev articles12345678910 11 12Next articles



Date


Computer & I'net articlesDate

by David Stanley    



The date and gmdate commands return the value of the current date. The regular date returns information based on the online host server. The gmdate returns information based on the Greenwich Meridian (the center of the timezones).

date ("formatting");
gmdate ("formatting");

There are many variations to use in formatting the outcome of a date. Using the date command without any formatting will result as blank. Here is a list of formatting options :

a am or pm
A AM or PM
d day of the month - 01 to 31
D day of the week - 3 letters
F month - long format
g hour of the day - 1 to 12
G hour of the day - 0 to 23
h hour of the day - 01 to 12
H hour of the day - 00 to 23
i minutes - 00 to 59
j day of the month - 1 to 31
l day of the week - long format
L leap year test - 0 or 1
m month - 01 to 12
M month - 3 letters
n month - 1 to 12
s seconds - 00 to 59
S English suffix - 2 letters
t number of month days - 28 to 31
T timezone setting for this machine
U seconds since epoch
w day of week - 0 to 6
y year - 2 digits
Y year - 4 digits
z day of the year - 0 to 365
Z timezone offset in seconds

Using a combination of these letters, the date and time may be displayed in a number of ways. Example...
echo "Today is " . date("F jS, Y") . "<br>";
echo "The time is " . date("g:i:s a");

The result is :
Today is December 10th, 2003
The time is 8:13:11 am



-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.





Adjusted Cost


  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com