5 days */ public static function getNumberDayBetween($from, $to = false) { $to = ($to === false ? self::getCurrentTimestamp() : strtotime($to)); $from = strtotime($from); $date_diff = $to - $from; return ceil($date_diff / (60 * 60 * 24)); } /** * Get List Of Two Days * * @param array $args * @return array * @throws \Exception */ public static function getListDays($args = array()) { // Get Default $defaults = array( 'from' => '', 'to' => false, 'format' => "M j" ); $args = wp_parse_args($args, $defaults); $list = array(); // Check Now Date $args['to'] = ($args['to'] === false ? self::getCurrentDate() : $args['to']); // Get List Of Day $period = new \DatePeriod(new \DateTime($args['from']), new \DateInterval('P1D'), new \DateTime(date('Y-m-d', strtotime("+1 day", strtotime($args['to']))))); foreach ($period as $key => $value) { $list[$value->format('Y-m-d')] = array( 'timestamp' => $value->format('U'), 'format' => $value->format(apply_filters('wp_statistics_request_days_format', $args['format'])) ); } return $list; } }