I currently have a repeater field setup with several fields inside including the date picker. When I do the query to get the sub field rows it works fine but the date is outputted 11132013 and I want it to be a clean format. I used the code to format the date output but I can't seem to get it to work when there are multiple rows. How do you reset the query so I can format the date correctly. I am including screenshots and code samples. There may be an easier way of doing it. Thanks in advance!
Below is the code I am using to output the rows and format the date. Attached is a screenshot of what happens, it stops on the first row because it can't complete the query.
This works but as you can see in the screenshot it outputs the date as 20130101 instead of the format I want which is M d, y.
Below is the code I am using to output the rows and format the date. Attached is a screenshot of what happens, it stops on the first row because it can't complete the query.
<?php $revdate = DateTime::createFromFormat('Ymd', get_field('date')); ?>
<?php if(get_field('file_upload')): ?>
Type
Number
File Name
Rev Date
File
<?php while(has_sub_field('file_upload')): ?>
<?php the_sub_field('type'); ?>
<?php the_sub_field('number'); ?>
<?php the_sub_field('description'); ?>
<?php echo $revdate->format('M d, y'); ?>
" target="_blank">Download
<?php endwhile; ?>
<?php endif; ?>
This works but as you can see in the screenshot it outputs the date as 20130101 instead of the format I want which is M d, y.
<?php if(get_field('file_upload')): ?>
Type
Number
File Name
Rev Date
File
<?php while(has_sub_field('file_upload')): ?>
<?php the_sub_field('type'); ?>
<?php the_sub_field('number'); ?>
<?php the_sub_field('description'); ?>
<?php the_sub_field('date'); ?>
" target="_blank">Download
<?php endwhile; ?>
<?php endif; ?>