PHP is open source scripting language. It\'s widely used to develop web applications.  Home Web Programming PHP Date Function
Your Ad Here

Date Function


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



Author's URL: Valuedresource.com
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More PHP Tutorials at LearnPHP.org

Add comments to "Date Function"

Only registered users can write comment

Reader's comments