• Resolved pexel

    (@pexel)


    How do we calculate the total number of days between 2 dates and the number of weeks?
    Thanks.

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

    (@codepeople)

    Hello @pexel

    If you have two date fields (for example fieldname1 and fieldname2), the processes is very simple.

    # of days:

    ABS(fieldname1-fieldname2)

    # of weeks

    ABS(fieldname1-fieldname2)/7

    If any of the operands are not date fields, for example, to get the difference between a date field and the textual date like 28/01/2010, you can use the DATEDIFF operation:

    DATEDIFF(fieldname1, '28/01/2010', 'dd/mm/yyyy', 'd')['days']

    For the # of weeks it would be similar:

    DATEDIFF(fieldname1, '28/01/2010', 'dd/mm/yyyy', 'd')['days']/7

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Total number of days between 2 dates’ is closed to new replies.