Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Date query – Between two dates

Between January 1st 2015 and December 31st 2016.

$date_query = array(
	array(
		'before' => array(
			'year'  => 2016,
			'month' => 12,
			'day'   => 31,
		),
		'after' => array(
			'year'  => 2015,
			'month' => 1,
			'day'   => 1,
		),
		'inclusive' => true,
	),
);