113 * '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. 'IN', |
113 * '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. 'IN', |
114 * 'NOT IN', 'BETWEEN', and 'NOT BETWEEN'. Comparisons support |
114 * 'NOT IN', 'BETWEEN', and 'NOT BETWEEN'. Comparisons support |
115 * arrays in some time-related parameters. Default '='. |
115 * arrays in some time-related parameters. Default '='. |
116 * @type bool $inclusive Optional. Include results from dates specified in 'before' or |
116 * @type bool $inclusive Optional. Include results from dates specified in 'before' or |
117 * 'after'. Default false. |
117 * 'after'. Default false. |
118 * @type int|array $year Optional. The four-digit year number. Accepts any four-digit year |
118 * @type int|int[] $year Optional. The four-digit year number. Accepts any four-digit year |
119 * or an array of years if `$compare` supports it. Default empty. |
119 * or an array of years if `$compare` supports it. Default empty. |
120 * @type int|array $month Optional. The two-digit month number. Accepts numbers 1-12 or an |
120 * @type int|int[] $month Optional. The two-digit month number. Accepts numbers 1-12 or an |
121 * array of valid numbers if `$compare` supports it. Default empty. |
121 * array of valid numbers if `$compare` supports it. Default empty. |
122 * @type int|array $week Optional. The week number of the year. Accepts numbers 0-53 or an |
122 * @type int|int[] $week Optional. The week number of the year. Accepts numbers 0-53 or an |
123 * array of valid numbers if `$compare` supports it. Default empty. |
123 * array of valid numbers if `$compare` supports it. Default empty. |
124 * @type int|array $dayofyear Optional. The day number of the year. Accepts numbers 1-366 or an |
124 * @type int|int[] $dayofyear Optional. The day number of the year. Accepts numbers 1-366 or an |
125 * array of valid numbers if `$compare` supports it. |
125 * array of valid numbers if `$compare` supports it. |
126 * @type int|array $day Optional. The day of the month. Accepts numbers 1-31 or an array |
126 * @type int|int[] $day Optional. The day of the month. Accepts numbers 1-31 or an array |
127 * of valid numbers if `$compare` supports it. Default empty. |
127 * of valid numbers if `$compare` supports it. Default empty. |
128 * @type int|array $dayofweek Optional. The day number of the week. Accepts numbers 1-7 (1 is |
128 * @type int|int[] $dayofweek Optional. The day number of the week. Accepts numbers 1-7 (1 is |
129 * Sunday) or an array of valid numbers if `$compare` supports it. |
129 * Sunday) or an array of valid numbers if `$compare` supports it. |
130 * Default empty. |
130 * Default empty. |
131 * @type int|array $dayofweek_iso Optional. The day number of the week (ISO). Accepts numbers 1-7 |
131 * @type int|int[] $dayofweek_iso Optional. The day number of the week (ISO). Accepts numbers 1-7 |
132 * (1 is Monday) or an array of valid numbers if `$compare` supports it. |
132 * (1 is Monday) or an array of valid numbers if `$compare` supports it. |
133 * Default empty. |
133 * Default empty. |
134 * @type int|array $hour Optional. The hour of the day. Accepts numbers 0-23 or an array |
134 * @type int|int[] $hour Optional. The hour of the day. Accepts numbers 0-23 or an array |
135 * of valid numbers if `$compare` supports it. Default empty. |
135 * of valid numbers if `$compare` supports it. Default empty. |
136 * @type int|array $minute Optional. The minute of the hour. Accepts numbers 0-60 or an array |
136 * @type int|int[] $minute Optional. The minute of the hour. Accepts numbers 0-60 or an array |
137 * of valid numbers if `$compare` supports it. Default empty. |
137 * of valid numbers if `$compare` supports it. Default empty. |
138 * @type int|array $second Optional. The second of the minute. Accepts numbers 0-60 or an |
138 * @type int|int[] $second Optional. The second of the minute. Accepts numbers 0-60 or an |
139 * array of valid numbers if `$compare` supports it. Default empty. |
139 * array of valid numbers if `$compare` supports it. Default empty. |
140 * } |
140 * } |
141 * } |
141 * } |
142 * } |
142 * } |
143 * @param string $default_column Optional. Default column to query against. Default 'post_date'. |
143 * @param string $default_column Optional. Default column to query against. Default 'post_date'. |
872 * the level of precision and support the 'inclusive' parameter. |
872 * the level of precision and support the 'inclusive' parameter. |
873 */ |
873 */ |
874 if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { |
874 if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) { |
875 // Y |
875 // Y |
876 $datetime = array( |
876 $datetime = array( |
877 'year' => intval( $matches[1] ), |
877 'year' => (int) $matches[1], |
878 ); |
878 ); |
879 |
879 |
880 } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { |
880 } elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) { |
881 // Y-m |
881 // Y-m |
882 $datetime = array( |
882 $datetime = array( |
883 'year' => intval( $matches[1] ), |
883 'year' => (int) $matches[1], |
884 'month' => intval( $matches[2] ), |
884 'month' => (int) $matches[2], |
885 ); |
885 ); |
886 |
886 |
887 } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { |
887 } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) { |
888 // Y-m-d |
888 // Y-m-d |
889 $datetime = array( |
889 $datetime = array( |
890 'year' => intval( $matches[1] ), |
890 'year' => (int) $matches[1], |
891 'month' => intval( $matches[2] ), |
891 'month' => (int) $matches[2], |
892 'day' => intval( $matches[3] ), |
892 'day' => (int) $matches[3], |
893 ); |
893 ); |
894 |
894 |
895 } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { |
895 } elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) { |
896 // Y-m-d H:i |
896 // Y-m-d H:i |
897 $datetime = array( |
897 $datetime = array( |
898 'year' => intval( $matches[1] ), |
898 'year' => (int) $matches[1], |
899 'month' => intval( $matches[2] ), |
899 'month' => (int) $matches[2], |
900 'day' => intval( $matches[3] ), |
900 'day' => (int) $matches[3], |
901 'hour' => intval( $matches[4] ), |
901 'hour' => (int) $matches[4], |
902 'minute' => intval( $matches[5] ), |
902 'minute' => (int) $matches[5], |
903 ); |
903 ); |
904 } |
904 } |
905 |
905 |
906 // If no match is found, we don't support default_to_max. |
906 // If no match is found, we don't support default_to_max. |
907 if ( ! is_array( $datetime ) ) { |
907 if ( ! is_array( $datetime ) ) { |