Format Codes for Use with date() : date function « Development « PHP






Format Codes for Use with date()

/*

Format                Description                                  Example

a                     'am' or 'pm' lowercase                       pm

A                     'AM' or 'PM' uppercase                       PM

d                     Day of month (number with leading zeroes)    20

D                     Day of week (three letters)                  Thu

F                     Month name                                   January

h                     Hour (12-hour format)                        12

H                     Hour (24-hour format)                        12

g                     Hour (12-hour format without leading 0)      12

G                     Hour (24-hour format without leading 0)      12

i                     Minutes                                      47

j                     Day of the month (no leading zeroes)         20

1                     Day of the week (name)                       Thursday

L                     Leap year ('1' for yes, '0' for no)          1

m                     Month of year (number)                       01

M                     Month of year (three letters)                Jan

n                     Month of year (number without leading 0)     1

s                     Seconds of hour                              24

U                     Time stamp                                   948372444

y                     Year (two digits)                            00

Y                     Year (four digits)                           2000

z                     Day of year (0?65)                           19

Z                     Offset in seconds from GMT                   0
*/
           
       








Related examples in the same category

1.Formatting a Date with date()