Support

Account

Home Forums General Issues Display upcoming events up to current hour Reply To: Display upcoming events up to current hour

  • Hi @svsdnb

    I believe Date/Time Picker add-on uses a timestamp to save the date in the database. If you use it, I believe you can do it like this:

    $today_timestamp = time();
    
    ...
    
    'meta_query' => array(
        'relation' => 'AND',
        'date_clause' => array(
            'key' => 'event_start_time',
            'compare' => '>=',
            'value' => $today_timestamp,
        ),

    If you use ACF’s new date time picker field, I believe you can do it like this:

    $today_datetime = date('Y-m-d H:i:s');
    
    ...
    
    'meta_query' => array(
        'relation' => 'AND',
        'date_clause' => array(
            'key' => 'event_date_begins',
            'compare' => '>=',
            'value' => $today_datetime,
            'type' => 'DATETIME',
        ),

    I hope this helps 🙂