Not signed in (Sign In)

Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    Anybody have a calculation to add or substract days from a date i.e. Field 1 =Today, Field2 =Today +1 ?

    Any help is greatly appreciated.
  2.  
    I too, need something similar... I need to know how many days have passed since June 30.
    • CommentAuthordbuschho
    • CommentTimeJan 31st 2011
     
    Hello Guys,

    I think what you're looking for is related to the previous post here:
    http://www3.formassembly.com/forum/discussion/420/calendar-related-javascript/

    ---
    1. Date calculation from two fields

    use by:
    1. including the contents of 'code' into your custom code block
    2. setting calendar field 1 to variable (example: _DOB)
    3. setting calendar field 2 to variable (example: _CHOSENDATE)
    4. in a new hidden text field add the formula: _calcDate(_DOB,_CHOSENDATE)

    the field will be set to the difference in days.

    code:

    <script>
    function _calcDate(dob,chosendate){
    if(dob == 0 || chosendate == 0){
    return 0;
    }

    var _chosendate = new Date(chosendate);
    var _dob = new Date(dob);

    return Math.floor( (_now-_chosendate) / (1000*60*60*24) );
    }
    </script>