Calculate the number of days between dates

  • Updated
  • Zingtree has built a handy webhook where you can calculate the number of days between dates. You just need to add a new Webhook and install it into the node where you want the calculation to take place. Here's how to set it up:

    Step 1: Add the Webhook to your Organization

    1. Go to Account, My Apps.
    2. Click on Add Webhook.
    3. Give the Webhook a name (like "Number of days"), and enter this for the webhook URL:
    https://zingtree.com/apps/webhook/filters/date_difference.php?

     

    The end result looks like this: 

    mceclip2.png

    Step 2: Call the webhook from your tree

    Somewhere in your tree, you likely have 2 data entry fields that are collecting the first and second dates. Make a note of those date variable names. For example:

    mceclip5.png

    Open your tree, and edit the node where you want the date difference to be calculated.

    1. Under the Apps / Webhooks tab, click Add App / Webhook.
    2. Pick the Webhook you added previously ("Date Difference", for example).
    3. In the Message Data area, enter something like this:
      &date1=#date1#&date2=#date2#&var=diff
      Replace #date1# and #date2# with your own variable names for the first and second dates

    4. Save the changes to the node.

    Your edits should look something like this:

    mceclip6.png

    Now just use #‌diff# anywhere you want to show the date difference. Example:
    mceclip7.png

  • Zingtree has built a handy webhook where you can calculate the number of days between dates. You just need to add a new Webhook and install it into the node where you want the calculation to take place. Here's how to set it up:

    Step 1: Add the Webhook to your Organization

    1. Go to Account, My Apps.
    2. Click on Add Webhook.
    3. Give the Webhook a name (like "Number of days"), and enter this for the webhook URL:
    https://zingtree.com/apps/webhook/filters/date_difference.php?

     

    The end result looks like this: 

    mceclip2.png

    Step 2: Call the webhook from your tree

    Somewhere in your tree, you likely have 2 data entry fields that are collecting the first and second dates. Make a note of those date variable names. For example:

    mceclip4.png

    Open your tree, and edit the node where you want the date difference to be calculated.

    1. Under the Apps / Webhooks tab, click Add App / Webhook.
    2. Pick the Webhook you added previously ("Date Difference", for example).
    3. In the Message Data area, enter something like this:
      &date1=#date1#&date2=#date2#&var=diff
      Replace #date1# and #date2# with your own variable names for the first and second dates

    4. Save the changes to the node.

    Your edits should look something like this:

    mceclip3.png

    Now just use #‌diff# anywhere you want to show the date difference. Example:

    mceclip8.png
  • What's this mean?

    Throughout 2022 Zingtree will be migrating customers to our new faster and more modern user experience! Here's how to tell which experience your Zingtree Authors are currently using.

    Log in to your Zingtree Author account and navigate to My Trees. How does your current My Trees page look?

    Zingtree Classic

    2022-02-25_12-24-51.png

    New User Experience

    2022-02-25_12-26-39.png

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request