date functions in php

By | June 1, 2014

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