website promotion banner
eturnkeys
Your Ad Here
Web Programming  Home Web Programming PHP Date Function
rss

Date Function

Author: Valuedresource.com More by this author


Date FunctionThe date function turns the symbols displayed in the date format symbols table into the examples also shown in the table.

Date Format Symbols
Symbol Meaning Example
M Month in text, abbreviated Nov
F Month in text not abbreviated November
m Month in numbers with leading zeros 02, 12
n Month in numbers without leading zeros 1, 12
d Day of the month; two digits with leading zeros 01, 14
j Day of the month without leading zeros 3, 30
l Day of the week in text not abbreviation Friday
D Day of the week in text as an abbreviation Fri
w Day of the week in numbers From 0 (Sun) to 6 (Sat)
Y Year in four digits 2005
y Year in two digits 05
g Hour between 0 and 12 without leading zeros 2, 10
G Hour between 0 and 24 without leading zeros 2, 15
h Hour between 0 and 12 with leading zeros
01, 10
H Hour between 0 and 24 with leading zeros 00, 23
i Minutes 00, 59
s Seconds 00, 59
a am or pm in lowercase am, pm
A AM or PM in uppercase AM, PM

The parts of the date can be separated by hyphens (-), dots (.), forward slashes (/), or spaces.

Example:

<?php $today = date("l–j F Y"); echo "$today";?>

Preview:

Tuesday-28 November 2006




Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Date Function"