Thanks! I ended up figuring it out through much trial and error and banging my head against the keyboard. Surprised it worked haha.
I also added a way to print the date in a more easily readable format. In case anyone else needs the code:
` <?php
// args
$args = array(
‘post_type’ => ‘events’,
‘posts_per_page’ => -1,
‘meta_key’ => ‘speaking_event_date’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘ASC’
);
// query
$wp_query = new WP_Query( $args );
// loop
while( $wp_query->have_posts() )
{
$wp_query->the_post();
$date = date_create(”.get_field(‘speaking_event_date’).”);
//echo get_post_meta($post->ID,’speaking_event_date’,true) . ‘<br />’;
echo ‘<li>’ . get_the_title() . ‘ – ‘ . date_format($date,’d F Y’) . ‘</li>’;
echo ‘<p>’ . get_the_content() . ‘</p>’;
}
?> `
All you need to do it something like:
echo '<li>
' . get_the_title() . '
' .the_field('speaking_event_date') . '
</li>';

Hi @bildworter
Please search this forum as there are a few discussions regarding translating a date picker value.
Thanks
E
I followed istructions to manipulate the results here
http://www.advancedcustomfields.com/resources/field-types/date-picker/
but I didn’t yet understand how to change the language.
here my code:
<?php $date = get_field('name-field');
$y = substr($date, 0, 4);
$m = substr($date, 4, 2);
$d = substr($date, 6, 2);
$time = strtotime("{$d}-{$m}-{$y}");?>
<?php echo date('l D M Y', $time); ?>
It work but I need it in other language and in forums I didn’t find the relative solution.
Help, please.
Hi @elliot,
I went ahead and copy/pasted the latest datepicker build from jQuery UI and it works now. Your specific input JS seems to be fine.

Hi @synergywp
I may need to update the datepicker JS.
Thanks
E

Please save the date data as yymmdd. This is the default and most effective format.
To then retrieve only the year data, you can do this:
$date = get_field('date');
// $date = 19881123 (23/11/1988)
// extract Y,M,D
$y = substr($date, 0, 4);
source: http://www.advancedcustomfields.com/resources/field-types/date-picker/
Hi @elliot-
Yep, I’m only saving the yy because I only need to display the yy on the front-end. So, now that I understand that ACF requires mm/dd/yy, I now need to work out to only display the yy portion of the date. If you have a hint, that’d be great. Otherwise it may just be easier to use a text field.
Thanks
To further expand:
the ‘Taxonomy field’ is a select type field.
So for exmaple a Toxonomy is made for a publisher. Post creation has a nice dropdown menu based on those Toxonomys.
Any data that is stored in the Image/Date Picker/Text Area fields all display correctly.
Only the Toxonomy Fields return Id’s and not the actual data.
There are no documents explaining the purpose of the ‘Toxonomy Field’ or correct usage. But as far as seeing where the data IS it works fine. It just does not show the ACTUAL data itself 🙁

I think the solution to the issue in your description itself. You say that you are only saving the yy. ACF would require that you save the yy, mm, and dd to render a value into the date picker field.
To sum up, your save_format requires more than just the yy value.
Thanks
E

Hi @Petehawk
Perhaps you could take a look at the docs page to see how you can use the datepicker in different formats. There are a few different tactics to extract the date attributes and re-format them.
Good luck
Thanks
E
Well, I’m using the picker provided by ACF (the plugin) if that’s what you mean? I’m not using an additional plugin to ACF for anything at this point.
Kyle, are you using the date/time picker plugin with ACF? If so, that’s the problem. That plugin is poorly supported and doesn’t seem coded very well and I’ve often run into the exact problem you’re having when using it.
Hi Elliot,
Thank you very much for the reply.
Before I noticed this I was still working on this problem, and got the following to work:
<?php
$currentdate = date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));
$wp_query = new WP_Query( array (
'post_type' => 'events',
'meta_query'=> array(
array(
'key' => 'start_date',
'compare' => '>',
'value' => $currentdate,
'type' => 'DATE',
)),
'meta_key' => 'start_date',
'orderby' => 'meta_value',
'order' => 'ASC',
'posts_per_page' => 12,
'paged' => $paged,
)
); ?>
Its not counting the expired posts and is paging perfectly too.
Thanks again for the reply,
Darren.

Have you debuged the data in $the_query with a simple print_r ?
You may find that only 3 posts are found using your query args.
Thanks
E
I found a simple script which allowed me to show upcoming events.
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$the_query = new WP_Query( array(
'post_type' => 'events',
'posts_per_page' => 4,
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => 'start_date',
'paged' => $paged
) );
$current_header = '';
while ( $the_query->have_posts() ) :
$the_query->the_post();
# get the datum for this post
$temp_date = get_post_meta( get_the_ID(), 'start_date', true );
if (strtotime($temp_date) > strtotime('now')){
if ( $temp_date != $current_header ) {
$current_header = $temp_date;
include 'item-archive.php';
}?>
<?php } endwhile;?>
I also removed the pagination chaining because I couldn’t get it to work with this code.
I have one tester event that has expired, just to ensure its not showing expired events. I have it set to 4 post per page for testing, however on page 1 it only shows 3 posts, like the hidden event is still being counted.
I’ve been searching for a good solution for this all day, however I can’t find anything that will make it work.
If anyone can solve this for me I’d love to buy them a few beers.
I’m not sure if it makes any difference or not that its a date picker field.

Hi @zecka
Here are 2 links to previous threads which demonstrate how you can translate the PHP date time functions!
http://old.support.advancedcustomfields.com/discussion/840/datepicker-language/p1
http://support.advancedcustomfields.com/forums/topic/date-picker-language-front-end/
Thanks
E
I have try thry this but i want to show my date in french like that (25 septembre). So i change the last line like that: echo date(‘F m’, $time);
But the text is in English, how can i set it in french?
Hi Floris,
i had the same problem 2 days ago with a german language website and i`ve found a simple solution.
please see here: http://oenj.justbemotion.com/stockschiessen/ergebnisse-stockschiessen/ (first column, Mrz stands for März)
here is the solution i have used:
<?php
$dateStart = date_i18n("d M Y", strtotime(get_sub_field('stcksch_termine_datum1')));
?>
<?php if(get_sub_field('stcksch_termine_datum1')): ?>
<?php echo $dateStart; ?>
<?php endif; ?>
hope it helps.
regards,
andi
EDIT: i have used it as a subfield in a repeater field, so please use get_field instead of get_sub_field.
I don’t see that and don’t see any acf scripts loading on the front page however on the backend/admin pages they are loading… is there a simple line of include i could use?
I tried to include …. This did remove the errors but didn’t fix the issue
<script type='text/javascript' src='/advanced-custom-fields/js/input.min.js?ver=4.2.2'></script>
<script type='text/javascript' src='advanced-custom-fields/core/fields/date_picker/jquery.ui.datepicker.js?ver=4.2.2'></script>

Hi @floriz
Thanks for the code. I’m sure there is a function in the WP core for us to use in this scenario, I’m just not sure which one…
Thanks again.
Cheers
E
it would be so much better if it just uses the WordPress language settings as standard output.
Ok, solved it now. Not the most beautiful solution but it works:
<?php if (have_posts()) :
$paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
$today = date( ‘Ymd’, strtotime( ‘-1 day’ ) );
query_posts( array(
‘post_type’ => ‘agenda’,
‘meta_key’ => ‘datum_event’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘ASC’,
‘posts_per_page’ => 12,
‘paged’ => $paged,
‘meta_query’ => array(
array(
‘key’ => ‘datum_event’,
‘meta-value’ => $today,
‘value’ => $today,
‘paged’ => $paged,
‘compare’ => ‘>’ // DEZE AANPASSEN OM OUDE ITEMS TE LATEN ZIEN
)
)
) );
date_default_timezone_set( ‘Europe/Amsterdam’ );
setlocale( LC_ALL, ‘nl_NL’ ) or setlocale( LC_ALL, ‘nld_NLD’ );
$months = explode( ‘,’, ‘,jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec’ );
while (have_posts()) : the_post();
$date = DateTime::createFromFormat( ‘Ymd’, get_field( ‘datum_event’ ), new DateTimeZone( ‘Europe/Amsterdam’ ) );
?>
<p class=”jaar”><?php echo $date->format( ‘Y’ ); ?></p>
<p class=”dag”><?php echo $date->format( ‘j’ ); ?></p>
<p class=”maand”><?php echo $months[ $date->format( ‘n’ ) ]; ?></p>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.