How to get first day of week in PHP?

In PHP, you can get the first day of the week using the date() and strtotime() functions. The default first day varies by locale, but you can specify whether you want Monday or Sunday as the first day.

Getting Monday as First Day

By default, PHP considers Monday as the first day of the week when using "this week" −

<?php
    $res = date('l - d/m/Y', strtotime("this week"));
    echo "First day = " . $res;
?>
First day = Monday - 09/12/2019

Getting Sunday as First Day

To get Sunday as the first day of the week, you can use different approaches −

<?php
    echo "Displaying Sunday as first day of a week...<br>";
    $res = date('l - d/m/Y', strtotime("sunday 0 week"));
    echo "First day = " . $res;
?>
Displaying Sunday as first day of a week...
First day = Sunday - 15/12/2019

Alternative Methods

You can also use more explicit date calculations −

<?php
    // Get current week's Monday
    $monday = date('Y-m-d', strtotime('monday this week'));
    echo "This week's Monday: " . $monday . "<br>";
    
    // Get current week's Sunday
    $sunday = date('Y-m-d', strtotime('sunday last week'));
    echo "This week's Sunday: " . $sunday;
?>
This week's Monday: 2019-12-09
This week's Sunday: 2019-12-08

Conclusion

Use strtotime("this week") for Monday-based weeks or strtotime("sunday 0 week") for Sunday-based weeks. The date() function formats the result as needed.

Updated on: 2026-03-15T08:18:21+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements