How to get the first date of the week in PHP?

To get the first date of the current week, you need subtract the numeric representation of the day of the week to the given date, in this case the current date.

The code will return the timestamp of the first date of the current date.

$timestamp = mktime(0, 0, 0, date('m'), date('d') - date('w'), date('Y'));

From the code above, we can create functions that will return the first day of the week on any given date.

Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. vilma sanctis
    Posted July 22, 2008 at 3:13 pm | Permalink

    I need to know about the real magic cream- I need to buy some products and i belive you have developed the site, could you advise the correct contact number, as the number mentioned in the site are incorrect.

    thanks and regards
    Vilma Sanctis

  2. James
    Posted July 22, 2008 at 3:19 pm | Permalink

    Hi Vilma, my last contact with my client was way back in 2005 when I’m in Riyadh and I’m not sure if these number I had are still working. I’ll be sending the contacts to your email.

    thanks.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*