Home › Forums › Front-end Issues › How do the date of publication by a front-end form? › Reply To: How do the date of publication by a front-end form?
Hi @buylov
That’s weird. I tested it on my end last time and it’s working. Could you please explain to me what do you mean by “not work”? Does the date change to the selected date or use the current date?
If you want to set the time manually, I think you can add two more dummy fields for the hours and minutes. After that, you can add it to $theDate variable like this:
$theDate = get_field('post-date', $post_id, false);
$theDate = $theDate . "|" . get_field('dummy_hour', $post_id, false);
$theDate = $theDate . ":" . get_field('dummy_minute', $post_id, false);
if($theDate){
$theDate = date_create_from_format('Ymd|H:i', $theDate);
I hope this helps.
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.