Support

Account

Home Forums Add-ons Repeater Field Get only next date of repeater fields Reply To: Get only next date of repeater fields

  • Hi @marianrick

    I believe you can do it like this:

    // check if the repeater field has rows of data
    if( have_rows('repeater_field_name') ):
        $have_date = false
        $today = date('Ymd');
        
     	// loop through the rows of data
        while ( have_rows('repeater_field_name') ) : the_row();
    
            $thedate = get_sub_field('si-date', false);
            if($thedate > $today){
                $have_date = true;
                $dateformatstring = "d.m. l,";
                $unixtimestamp = strtotime($thedate);
                echo date_i18n($dateformatstring, $unixtimestamp); 
            }
    
        endwhile;
        
        if(!$have_date){
            echo "no dates";
        }
    
    else :
    
        // no rows found
    
    endif;

    I hope this helps.