Hi @hube2,
Thanks that explains the use of false, I have done some spring cleaning. Here is the working end result.
<?php $slide_datepicker = strtotime( get_sub_field('slide_datepicker', false, false) ); ?>
<time class="home__slide__date" datetime="<?php echo date('Y-m-d', $slide_datepicker); ?>"><?php echo date('d | m | Y', $slide_datepicker); ?></time>
Thanks for the support!
Hi @hube2 thanks for the timely response.
My main data needed is just the date, so I am happy to ignore the time aspect to the data.
How would you approach returning two values:
<time class="home__slide__date" datetime="<?php echo $date->format('Y-m-d'); ?>"><?php echo $date->format('d | m | Y'); ?></time>
I just want to change the order and symbols in the echo’ed areas. Do you have any ideas? Just repeating it twice is not valid in the former datetime attribute.
Many thanks,
Neil
@lucidlips while I agree your solution is simple, I think data entered and set a non-published documents / post entry is not made public, it should not be pulled through as such.
I think the default should be published only. If a developer wants to change this a php template change should be made available for an override.
Just my 2 pennies..
Great code example btw!
Hi John,
I think there is some confusion, I am looking for the date format only.
The documentation points towards using “new DateTime”:
https://www.advancedcustomfields.com/resources/date-picker/
I can see your point of view however, I am looking to create two formats of data per repeater row item (variable created).
Does this clear things up?
Many Thanks,
Neil
Hey Guys,
Same issue for me also, I got a code example using new date.
Did anyone get a fix with this issue?
Many thanks,
Neil
I have just tried the above to no avail.
Was there anything that else that needs doing?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.