Home › Forums › Backend Issues (wp-admin) › Date Time Picker and Countdown Timer › Reply To: Date Time Picker and Countdown Timer
Hi @brandonpweb
Could you please try this code instead:
$now = new DateTime();
$date = get_field('date_time_picker', 85);
$date = new DateTime( $date );
$interval = $now->diff($date);
echo '
<div class="alert alert-info">
<button type="button" class="close" date-dismiss="alert" aria-hidden="true">&time;</button>
<strong>Time</strong><br>
Day: ' . $interval->format( '%d' ) . '<br>
Hours: ' . $interval->format( '%h' ) . '<br>
Minutes: ' . $interval->format( '%i' ) . '<br>
Seconds: ' . $interval->format( '%s' ) . '<br>
</div>
';
This page should give you more idea about it: http://stackoverflow.com/questions/14675739/php-datetime-countdown.
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.