Days Calculation (in: Date type A/ Date type B, out: Numeric type C)

Calculate the number of elapsed days from the two specified dates and store it in a data item

    A. Select DATE DATA [e.g.2016-09-01]Data selectDateRequired
    B. Select DATE DATA [e.g.2016-09-03]Data selectDateRequired
    C. Select NUM OF ELAPSED DAYS DATA [2] (update)Data selectNumericRequired
    -variable namevariable label
    Aconf_DataIdASelect DATE DATA [e.g.2016-09-01]
    Bconf_DataIdBSelect DATE DATA [e.g.2016-09-03]
    Cconf_DataIdCSelect NUM OF ELAPSED DAYS DATA [2] (update)
    //// == 自動工程コンフィグの参照 / Config Retrieving ==
    var dataIdA = configs.get( "conf_DataIdA" ); // (returns Number)
    var dataIdB = configs.get( "conf_DataIdB" ); // (returns Number)
    var dataIdC = configs.get( "conf_DataIdC" ); // (returns Number)
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var dayA = data.get( dataIdA );
    var dayB = data.get( dataIdB );
    
    //// == 演算 / Calculating ==
    var msec = dayB.getTime() - dayA.getTime();
    var days = Math.round( msec / 1000 / 3600 / 24 );
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdC, java.math.BigDecimal( days ) );
    

    • A’: Date stored in the Data Item selected in config A
    • B’: Date stored in the Data Item selected in config B
    • The number of days elapsed from A’ until B’ (an integer value) will be stored in the Data Item selected in config C