Support

Account

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>';
    ?>