Home › Forums › General Issues › Entering and Displaying Time Duration › Reply To: Entering and Displaying Time Duration
Since i needed something like this, I found a very simple way to accomplish this:
1. Create a time picker field with return and display format set to H:i
2. If is a front end form hide “now” button with css.
3. use this in your template to get time
<?php
$preptime = get_field('prep_time');
$preparr = explode(':', $preptime);
$hour = $preparr[0];
$min = $preparr[1];
echo '<time content="PT'.$hour.'H'.$min.'M" itemprop="prepTime">'.$preptime.'</time>';
?>
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.