Following characters will define the day in a date function
————————————————————-
DAY
d- day of the month,2 digits with leading zeros 01-31
D- Day as a text, three letters Mon-Sun
j- Day of the month without leading zeros 1-31
l- Full textual representation of day- Sunday-Saturday
————————————————————-
Week
W-week number of the year.
————————————————————-
Month
F-full textual representation of the month- January-December
m- numeric representation of a month with leading zeros-01-12
M-short textual representation -3 letters- Jan-Dec
n- numeric representation of a month without leading zeros-1-12
t- number of days in a given month 28-31
————————————————————-
Year
L- whether it is a leap year- if leap year1 otherwise 0.
o,Y- show the year-1999-2014
y- 2 digit representation of year-99-14
————————————————————-
Time
a- it shows am/pm
A- it shows AM/PM
g-12 hour format without leading zero-1-12
G-24 hour format without leading zero- 0-23
h-12 hour format with leading zero-01-12
H- 24 hour format with leading zero 00-23
i- minutes, with leading zero- 00-59
s-Seconds, with leading zero- 00-59
u- microseconds
———————————————————–
Some Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php echo date("d-m-y", time()); // 27-05-14 echo date("D j/n/Y", time()); //Tue 27/5/2014 echo date("jS of F Y", time()); // 27th 2014f May 2014 echo date("d M y", time()); //27 May 14 echo date("l jS of F", time()); // Tuesday 27th 2014f May echo date("G:i:s", time()); //14:57:29 echo date("H:i:s", time()); //14:57:29 echo date("g:i a.", time()); //2:57 pm. echo date("h:i A.", time()); //02:57 PM. echo date("l jS of F g:i A.", time()); // Tuesday 27th 2014f May 2:57 PM. echo date("D M j G:i:s T Y", time()); // Tue May 27 14:57:29 CEST 2014 ?> |