Un motore di ricerca WordPress per sviluppatori e autori di temi



_wp_mysql_week ›

Da3.0.0
Deprecaton/a
_wp_mysql_week ( $column )
Parametri:
  • (string) $column Database column.
    Richiesto:
Ritorna:
  • (string) SQL clause.
Definito a:
Codex:

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



Sorgenti

function _wp_mysql_week( $column ) {
	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
		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 )";
		case 0:
		default:
			return "WEEK( $column, 0 )";
	}
}