Dates formats and examples

Y (years)

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

m (month)

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

d (day)

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

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

<?php echo date('Y-m-d'); ?>
output: 2024-02-25

D (week day, only three letters)

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

l (week day, full word)

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

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

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

S (Week day on letters like D format)

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

W (Weeks number of year)

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

j (month day 1-31, without 0)

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

j (month day 1-31, without 0)

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

F (full month name on English)

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

m (month number of year 1-12)

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

M (Month on letters like D format)

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

z (year day 0-365)

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