Stilistic Dev /// Munky Style head_bg head end
nav begin hometutorialsgallerydownloadsservicesportfoliocontactabout
default   blue   orange   black   purple   yellow   teal   green   red  


Google
 
Web StilisticDev.net
mhtr Time and Date using PHPmhtr
 
mbtl   mbtr
  In this tutorial we will learn how to display the day and/or time by using php. It's a very easy thing to do using php (theres only one line of code, thats right, only one!) so, lets get started.



Alright, brace yourself, here is the huge code we use:



<?

echo date("m-d-y") //this will display the date in mmddyy format

?>




See that wasn't so hard was it? So now whats next? Well I guess we need to know how to format the date huh? Here's a list of different charectures and what they do use to format the date:

a "am" or "pm"
A "AM" or "PM"
d Day of the month with a leading zero (01-31)
D Day of the week abrivation (Mon-Sun)
F Month (January-December)
g Hour in 12-hour format without leading 0 (1-12)
G Hour in 24-hour format without leading 0 (0-23)
h Hour in 12-hour format withleading 0 (01-12)
H Hour in 24-hour format with leading 0 (00-23)
i Minutes with leading zero (00-59)
I "1" if the date is in daylights savings time, otherwise "0"
j Day of the month without a leading zero (1-31)
l Day of the week (Monday-Sunday)
L "1" if the year is a leap year, otherwise "0"
m Month a with a leading zero (01-12)
M Month abriviation (Jan-Dec)
n Month without a leading zero (1-12)
O The difference to Greenwich time (GMT) in hours
r An RFC 822 formatted date (e.g. "Tue, 10 Apr 2005 18:34:07 +0300")
s Seconds with a leading zero (00-59)
S Suffix for the day of the month (st, nd, rd or th)
t The number of days in the current month (28-31)
T Time zone (e.g. "GMT")
U The number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
w Day of the week as a number (0-6, 0=Sunday)
W ISO-8601 week number of year, weeks starting on Monday
Y Year in yyyy format (e.g. 2003)
y Year in yy format (e.g. 03)
z Day of the year as a number (0-366)


Well thats it for the displaying time, now we can learn how to do a custom greeding by usng our time. So lets go to the next tutorial, custom greeding with php
 
mbbl   mbbr