Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    To get the number of days between today and the conception date (fieldname2), you simply should use the equation:

    (function(){
    var days = ROUND((new Date()).valueOf()/86400000);
    return ABS(days-fieldname2);
    })()

    To get the number of weeks you can divide the result by 7

    (function(){
    var days = ROUND((new Date()).valueOf()/86400000);
    return FLOOR(ABS(days-fieldname2)/7);
    })()

    To get the number of weeks and days:

    (function(){
    var days = ROUND((new Date()).valueOf()/86400000);
    return FLOOR(ABS(days-fieldname2)/7)+' weeks and '+(ABS(days-fieldname2)%7)+' days';
    })()

    Best regards.

Viewing 1 replies (of 1 total)

The topic ‘date calculation with week and day count’ is closed to new replies.