Using get_weekstartend function

Here’s an example of how to find the beginning and end dates of a given week using the WordPress function wp_weekstartend.

The function expects the date to come from a MySQL Query, but as long as you give it the date in the expected format (MySQL timestamps have the format Y-m-d h:i:s), then you can use it for any date.  A more friendly format to output on the screen may be j m Y, for example, but you can easily convert between formats using the PHP date function.

 

Leave a Reply

Your email address will not be published. Required fields are marked *