Support

Account

Home Forums ACF PRO ACF Pro Dates Showing Jan 1 1970 Reply To: ACF Pro Dates Showing Jan 1 1970

  • I actually solved it after a few forum reads:

    while (has_sub_field('dates')) {
    								if(get_sub_field('event_date')) {
    									if ($i == 0) {
    										$event_date = get_sub_field('event_date', false, false);
    										$event_date = new DateTime($event_date);
    										$new_time = $event_date->format('ga');
    
    										$first_date = $event_date->format('F j');
    
    										echo $first_date;
    									}
    									if($i == ($num - 1)) {
    										$last_date = $event_date->format('j');
    										$last_date_compare = $event_date->format('F j');
    										if ($first_date != $last_date_compare) {
    											echo ' - ' . $last_date;
    										}
    									}
    								}
    								$i++;
    							}

    have to add the ‘format’ line.