To group events according to date in upcoming events and prior events below is the code:

<?php 
$today = date('Ymd');
$queryPost = Array(
  'post_type' => 'events',
  'meta_query' => array(
array(
'key'     => 'event_start_date',
'value'   => $today,
'compare' => '>=',
),
),
  'posts_per_page' => 5,
  'meta_key' => 'event_start_date',
  'orderby' => 'meta_value_num',
  'order' => 'ASC',
  'paged' =>$paged
);
query_posts($queryPost);
?>

Here, we have stored current date in '$today' variable and fetched only those events where event_start_date is greater or equal to current date i.e. event start date is either today's date or a future date. This is the way we can show upcoming events. If the condition is changed to less than ( < ) current date i.e. event start date is in past then it will show all prior events.

For this query to work the backend structure for Event Start Date field should be as below:

Save format is 'yymmdd' and we have used $today = date('Ymd'); so that dates can be compared.

Note: event_start_date is custom field name which we have created for event date.

Client Name: 
Vindicia