• Resolved vegasdood

    (@vegasdood)


    I have your plugin successfully implemented on another site….but, I am completely stumped on the simplest of needs. I have stared, studied and clone your date examples but it just ain’t working for me.
    I just need a basic pick date, today’s day and a today number of days from the pick date to today’s date.
    I have tried variations of this:
    abs(fieldname1+fieldname2)
    abs(fieldname1+fieldname2)*(+1)
    Thinking somehow I need to tell the calculator to convert calendar dates to single days. I know this must be awfully simple but I am stumped. Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    I’ll try to explain the process with an example:

    Assuming your date/time field is the fieldname1, and you want calculate the number of days from the selected date and today, the equation in this case would be similar to:

    (function(){
    var today = (new Date()).getTime()/86400000, selected_date = fieldname1;
    return CEIL(today-selected_date);
    })()

    If you are using the Developer or Platinum versions of the plugin that are distributed with the Date/Time module of operations, the equation would be simpler:

    DATEDIFF(NOW(), fieldname1, 'mm/dd/yyyy', 'd')['days']+1

    and that’s all.

    If you need addition help implementing your equations, we can offer you a custom coding service from my private website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter vegasdood

    (@vegasdood)

    Thanks a mill for the quick reply and the code. I would have never ended up there. Still using the free plugin but I will seriously consider supporting the paid version. Thanks again!

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Please, edit the line of code:

    return CEIL(today-selected_date);

    as follows:

    return CEIL(ABS(today-selected_date));

    To optain a positive result.

    Best regards.

    Thread Starter vegasdood

    (@vegasdood)

    Weird….it worked with your original code but not with the revised code.

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Please, be sure all parenthesis are right.

    Best regards.

    Thread Starter vegasdood

    (@vegasdood)

    Ooops..I see what you are talking about…I did not add the second closing parenthesis. Working like gangbusters now. If I did not put a 5-star rating before, I will now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘This Chump is STUMPED’ is closed to new replies.