Title: Time difference between countries
Last modified: July 24, 2023

---

# Time difference between countries

 *  Resolved [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/)
 * Hello;
 * Thank you for this nice plugin.
   Can we calculate the time difference between 
   countries? The user will select the country with a dropdown menu.Example : Option
   1 chose USA / AlaskaOption 2 chose France
 * In conclusion;
   It will write the USA / Alaska time 24/07/2023 14:50It will write
   the time of France 24/07/2023 15:50It will write the time difference as 1 hour
   as the result.Thanks.

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16918495)
 * Hello [@fibbu](https://wordpress.org/support/users/fibbu/),
 * Thank you very much for using our plugin.
 * Yes. You can calculate the time difference, but the solution depends on your 
   form structure.
 * For example, if you have two date/time fields in the form with only time components
   to allow the users to enter them (fieldname1 and fieldname2). Insert a calculated
   field in the form, and enter an equation similar to the following one:
 *     ```wp-block-code
       (function(){
       var d = DATEDIFF(fieldname1, fieldname2, 'dd/mm/yyyy hh:ii', 'h');
       return d['hours']+' hours and '+d['minutes']+' minutes';
       })()
       ```
   
 * If you have only two dropdown fields with places, I recommend entering the places’
   names as their choices’ texts and the time zones as their values (like France
   1 and Alaska -9). The equation would be:
 *     ```wp-block-code
       ABS(fieldname1-fieldname2)
       ```
   
 * Best regards.
 *  Thread Starter [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16918560)
 * So how do we get the current time of the country? I made a dropdown menu. Argentine(
   A) and Brazil (B). In summary, how can we apply the time zones of all countries?
   
   Your calculation method makes sense yes.
 *  Thread Starter [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16918579)
 * [Sample](https://saat-farki.hesaplama.net/)
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16918833)
 * Hello [@fibbu](https://wordpress.org/support/users/fibbu/)
 * You must enter the time zones in the dropdown fields.
 * Each choice in the DropDown fields contains two input boxes for the choice’s 
   text and value, respectively. You must enter the time zones as the choices’ values
   and country names as the choices’ texts.
 * You must determine the current time zone to calculate the date/time in the countries
   selected in the dropdown fields (fieldname1, fieldname2). The equation would 
   be similar to:
 *     ```wp-block-code
       (function(){
       var current_timezone = new Date().getTimezoneOffset()/(-60),
       result = NOW();
   
       result.setHours(result.getHours()-current_timezone+fieldname1);
       result.setHours(result.getHours()+fieldname2);
   
       return GETDATETIMESTRING(result, 'dd/mm/yyyy hh:ii a');
       })()
       ```
   
 * Please, note the plugin support does not cover the implementation of the users’
   projects. If you need a custom coding service to implement your project, please,
   contact us directly via the plugin website [Contact Us](https://cff.dwbooster.com/customization)
 * Best regards.
 *  Thread Starter [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920287)
 * Firstly, thank you. I made the clocks of the countries with the method you said.
   Only one minor problem remained.
 * jQuery(‘.criter-one’).html**(‘Saat Farkı: ‘);**
 * (‘Saat Farkı: ‘); How to print the selected Country name in Dropdown?
   Thanks
    -  This reply was modified 2 years, 10 months ago by [fibbu](https://wordpress.org/support/users/fibbu/).
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920521)
 * Hello [@fibbu](https://wordpress.org/support/users/fibbu/)
 * In the DropDown field, you must tick the “Choice text” option for the “Value 
   to submit” attribute (this modification does not affect the equations that remain
   using the choices’ values).
 * Assuming the dropdown field is the fieldname1, you can access the value of the
   choice selected from the equation as always, `fieldname1`, and its text by using
   the |v modifier `fieldname1|v`
 * If you have any other questions about coding, please, indicate the URL to the
   page that contains the form to check your code in action.
 * Best regards.
 *  Thread Starter [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920667)
 * fieldname my fields are 29 and 30
   to print them on the screen.jQuery(‘.criter-
   one’).html (‘fieldname29|v ‘);do i need to do?
 * Can you show me how to write a small example in this code?
   I have no other questions.
   thanks
 *  Thread Starter [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920684)
 * yes i did it thanks superrr
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920697)
 * Hello [@fibbu](https://wordpress.org/support/users/fibbu/)
 * The code depends on the place you use it.
 * If the code is part of an equation, the correct would be:
 *     ```wp-block-code
       jQuery('.criter-one').html(fieldname29|v);
       ```
   
 * Without quotes in the around the field’s name.
 * If the code is called from a different context, like the onclick event of a button,
   it would be:
 *     ```wp-block-code
       jQuery('.criter-one').html(getField('fieldname29').val(true, true));
       ```
   
 * If the tag with the `criter-one` class name is inside the form structure, like
   an “HTML Content” field, you would not need any of previous code, only to use`
   data-cff-field` attribute in the tag. Ex.
 *     ```wp-block-code
       <span class="criter-one" data-cff-field="fieldname29"></span>
       ```
   
 * Best regards.

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

The topic ‘Time difference between countries’ 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/)

 * 9 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/time-difference-between-countries/#post-16920697)
 * Status: resolved