Dates formats and examples

Y (years)

<?php echo date('Y'); ?>
output: 2022

m (month)

<?php echo date('m'); ?>
output: 05

d (day)

<?php echo date('d'); ?>
output: 18

Y-m-d (Years-month-day)

<?php echo date('Y-m-d'); ?>
output: 2022-05-18

D (week day, only three letters)

<?php echo date('D'); ?>
output: Wed

l (week day, full word)

<?php echo date('l'); ?>
output: Wednesday

N (week day on number 1 - monday, 7 - sunday)

<?php echo date('N'); ?>
output: 3

S (Week day on letters like D format)

<?php echo date('S'); ?>
output: th

W (Weeks number of year)

<?php echo date('W'); ?>
output: 20

j (month day 1-31, without 0)

<?php echo date('j'); ?>
output: 18

j (month day 1-31, without 0)

<?php echo date('j'); ?>
output: 18

F (full month name on English)

<?php echo date('F'); ?>
output: May

m (month number of year 1-12)

<?php echo date('m'); ?>
output: 05

M (Month on letters like D format)

<?php echo date('M'); ?>
output: May

z (year day 0-365)

<?php echo date('z'); ?>
output: 137