I'm using WordPress and custom_post_type. I have an array (php) and I would like to sort this one by date but by default sort by post_id :
First, I have a SQL query to load my posts from custom_post_type. For each post, if start date > current date :
global $wp_query;
$args = array(
    'posts_per_page' => '9999999',
    'orderby' => 'event_start_date',
    'post_type'=> 'ai1ec_event',
    'events_categories' => 'events',
    'order' => 'DESC',
    'post_status' => 'publish'
);
$the_query = new WP_Query( $args );
$tabId = array();
if ( $the_query->have_posts() ) {
    while( $the_query->have_posts() ) {
        $the_query->the_post();
        global $post;
        $idEvent = $post->ID;
$sql = "SELECT * FROM og2rm_ai1ec_events WHERE post_id = ".$idEvent.";";
$results = $wpdb->get_results($sql);
foreach($results as $event)
{
    $start_date = $event->start;
    $end_date = $event->end;
    $heure = date("Y-m-d", $event->start);
    $currentDate = date("Y-m-d");
    $todayStr = strtotime ($currentDate);
    $lieu = $event->address;
    $rue = $event->venue;
    if($start_date > $todayStr){
        $a++;
        $tabId[$idEvent] = array('debut'=>$start_date,"lieu"=>$lieu,"rue"=>$rue,"fin"=>$end_date);
        }
    }
$tabId[$idEvent] = array('debut'=>$start_date,"lieu"=>$lieu,"rue"=>$rue,"fin"=>$end_date);
/******* echo <pre> $tabId : *******/
[21379] => Array
    (
        [debut] => 1510336800
        [lieu] => Example
        [rue] => Example
        [fin] => 1510340400
    )
[21376] => Array
    (
        [debut] => 1510268400
        [lieu] => Example
        [rue] => Example
        [fin] => 1512255600
    )
[21375] => Array
    (
        [debut] => 1511616600
        [lieu] => Example
        [rue] => Example
        [fin] => 1511620200
    )
[21372] => Array
    (
        [debut] => 1511530200
        [lieu] => Example
        [rue] => Example
        [fin] => 1511533800
    )
And now, I did another foreach to display my posts but display by ID not by date.
I tried array_multisort or ksort / sort byt doesn't work.
Any idea ?
Thanks/
