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.


The following two tabs change content below.

Jeremy Varnham

Latest posts by Jeremy Varnham (see all)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">