1
0
-1

Hi everyone,

How if I want to calculate date difference from two fields (im using text field not date picker)?


eg:

Date start: 2020-08-17

Date finish: 2020-11-25

Duration in days: ______

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Use Google as your first choice, for example type "Joget calculate date dx" and the first result is your answer.

      1. nfmr

        I already try this one before but both my date is not from date picker but text fields so the output did not show up.

      2. Matthew King

        Here are more information here and Javascript API.

      3. nfmr

        So I use custom html and code like this but still nothing happen. Can you please help me to check which part is wrong? I've been working on these for a few days and keep changing my code also cannot. 

        The date format is dd/mm/yyyy.

        <script type="text/javascript">
        
        $( function(){
            $('input[name="PIC_joinDate_bottom1"], input[name="dateSubmit_bottom1"]').change( function(){
            var start = new Date($('#PIC_joinDate_bottom1').val()); 
            var end = new Date($('#dateSubmit_bottom1').val()); 
            var Difference_In_Time = end.getTime() - start.getTime(); 
            var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24); 
            $('input[name=PIC_duration_bottom1]').val(Difference_In_Days);
            });
        
        });
        </script> 


      CommentAdd your comment...