Title: Live countdown timer
Last modified: October 12, 2024

---

# Live countdown timer

 *  Resolved [pexel](https://wordpress.org/support/users/pexel/)
 * (@pexel)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/)
 * Hello,
 * Is there a function that allows the user to select a date and time, and then 
   shows the time difference between the selected date and today in days, hours,
   minutes, and seconds? Additionally, this would be displayed as a live countdown
   timer.
 * Is such a function available? Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068642)
 * Hello [@pexel](https://wordpress.org/support/users/pexel/)
 * Yes, you can use the DATEDIFF and NOW operations. Assuming the date/time field
   in the form is the fieldname1 field, you can insert a calculated field ( I’ll
   call it fieldname2 ) and enter an equation similar to:
 *     ```wp-block-code
       (function(){if ( typeof my_timout_identifier != 'undefined' ) clearTimeout( my_timout_identifier );my_timout_identifier = setTimeout( function(){ EVALEQUATION(fieldname2|n); }, 1000 );let o = DATEDIFF(NOW(), fieldname1, 'yyyy/mm/dd hh:ii', 'd');return CONCATENTATE(o['days'], ' days ', o['hours'], ' hours and ', o['minutes'], ' minutes');})()
       ```
   
 * Best regards.
 *  Thread Starter [pexel](https://wordpress.org/support/users/pexel/)
 * (@pexel)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068649)
 * **fieldname5**: Today’s date (day/hour/minute/second)
   **fieldname6**: Target 
   date (day/hour/minute/second)
 * However, it calculates the duration but does not count down. Could there be a
   mistake somewhere?
   Additionally, if the user selects a past date, is it possible
   to give a warning message for the countdown?Thank you!
 *     ```wp-block-code
       (function() {      if (typeof my_timeout_identifier !== 'undefined') {        clearTimeout(my_timeout_identifier);    }    my_timeout_identifier = setTimeout(function() {        EVALEQUATION(fieldname5 | n);    }, 1000);       let o = DATEDIFF(fieldname5, fieldname6, 'yyyy/mm/dd hh:ii:ss', 'd');       let kriter5 = CONCATENATE(o['days'], ' gün ', o['hours'], ' saat ', o['minutes'], ' dakika ', o['seconds'], ' saniye');    jQuery('#calculation-kriter5').html(kriter5);    jQuery('.kriter5-aciklama').html('Sayaç :');    jQuery('.kriter5-sonuc').html(kriter5);    return kriter5;})();
       ```
   
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068668)
 * Hello [@pexel](https://wordpress.org/support/users/pexel/)
 * First, you cannot include extra space characters.
 * The correct is `fieldname5|n` but you entered `fieldname5 | n`
 * Second, you must evaluate the current equation, not the equation in the fieldname5
   fields. Also, you don’t need a field extra to get the current date/time, only
   use the NOW operation.
 * Best regards.
 *  Thread Starter [pexel](https://wordpress.org/support/users/pexel/)
 * (@pexel)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068677)
 * I fixed the code, and it prints the result. Every time we click ‘calculate,’ 
   it prints the updated result. I wanted it to count down live after clicking ‘
   calculate’ just once.
 * Here’s the [form link.](https://www.pexpe.com?cff-form=382)
 *     ```wp-block-code
       (function() {      if (typeof my_timeout_identifier != 'undefined') {        clearTimeout(my_timeout_identifier);    }    my_timeout_identifier = setTimeout(function() {        EVALEQUATION(fieldname5|n);    }, 1000);       let o = DATEDIFF(NOW(), fieldname6, 'yyyy/mm/dd hh:ii:ss', 'd');       let kriter5 = CONCATENATE(o['days'], ' gün ', o['hours'], ' saat ', o['minutes'], ' dakika ', o['seconds'], ' saniye');    jQuery('#calculation-kriter5').html(kriter5);    jQuery('.kriter5-aciklama').html('Sayaç :');    jQuery('.kriter5-sonuc').html(kriter5);    return kriter5;})();
       ```
   
 *  Thread Starter [pexel](https://wordpress.org/support/users/pexel/)
 * (@pexel)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068685)
 * I got it done, thanks
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068688)
 * Hello [@pexel](https://wordpress.org/support/users/pexel/)
 * The calculated field in your form is not the fieldname5. So the code `EVALEQUATION(
   fieldname5|n);` makes no sense. You must enter the name of the calculated field
   where you entered the equation. Please reread my previous entries.
 * Please note the plugin support does not cover the implementation of the users’
   projects. If you need someone to implement your form equations, contact us through
   the plugin website. [Contact Us](https://cff.dwbooster.com/customization)
 * Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Live countdown timer’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/live-countdown-timer/#post-18068688)
 * Status: resolved