Support

Account

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 🙂