_wp_mysql_week

Definition:
function _wp_mysql_week( $column ) {}

Returns a MySQL expression for selecting the week number based on the start_of_week option.

Parameters

  • string $column

Source code

function _wp_mysql_week( $column ) {

	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {

	default :

	case 0 :

		return "WEEK( $column, 0 )";

	case 1 :

		return "WEEK( $column, 1 )";

	case 2 :

	case 3 :

	case 4 :

	case 5 :

	case 6 :

		return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";

	}

}

4401

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: