Converting a Date to an Age

  • Updated
  • Zingtree has built a handy webhook you can use to turn a person's birthdate into their age. 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 Settings, My Apps.
    2. Click on Add Webhook.
    3. Give the Webhook a name (like "date to age"), and enter this for the webhook URL:
      https://zingtree.com/apps/webhook/lib/date-to-age.php

     The end result looks like this:

     

    Step 2: Call the webhook from your tree

    If you have a variable called date, you can create a new variable named age as follows:

    1. Open your tree, and edit the node where you want the age calculated.
    2. Under the Apps / Webhooks tab, click Add App / Webhook.
    3. Pick the Webhook you added previously (Date to Age, for example).
    4. In the Message Data area, enter something like this:
      &result=age&date=#date#

      In the above example, the variable date is used to create a new variable called age.

    Your edits should look something like this:

    2022-04-27_20-03-02.png

     

    Now just use #‌age# anywhere you want to show the person's age based upon their birthday.

    Note: This is set up to work with any USA formatted date (year/month/day or yyyy-mm-dd). You may need to change the date format in your tree's Settings > Language to yyyy-mm-dd.

  • Zingtree has built a handy webhook you can use to turn a person's birthdate into their age. 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 "date to age"), and enter this for the webhook URL:
      https://zingtree.com/apps/webhook/lib/date-to-age.php

     The end result looks like this:

     

    Step 2: Call the webhook from your tree

    If you have a variable called date, you can create a new variable named age as follows:

    1. Open your tree, and edit the node where you want the age calculated.
    2. Under the Apps / Webhooks tab, click Add App / Webhook.
    3. Pick the Webhook you added previously (Date to Age, for example).
    4. In the Message Data area, enter something like this:
      &result=age&date=#date#

      In the above example, the variable date is used to create a new variable called age.

    5. Save the changes to the node.


    Your edits should look something like this:

     

    Now just use #‌age# anywhere you want to show the person's age based upon their birthday.

    Note: This is set up to work (year/month/day or yyyy-mm-dd). You may need to change the date format in your tree's Settings > Language to yyyy-mm-dd.

  • Throughout 2022 Zingtree will be upgrading 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

    mceclip0.png

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request