mbr_datediff
Usage
This shortcode returns the difference between two specified date formatted as requested.
The specified dates can be:
- The current date.
- Any date formatted according to the the syntax rules set for PHP as detailed within date formats.
- Any ActiveCampaign contact date field. Most ActiveCampaign date fields are properly formatted and will function correctly. See [mbr_contact] for information upon how to reference ActiveCamapign contact fields.
Parameters
Parameters | Description |
---|---|
from_date | The specified date must provide a value that follows the syntax rules set for PHP as detailed within date formats. Most ActiveCampaign date fields are properly formatted and will work. Default: The current date. Required: yes. |
to_date | The specified date must provide a value that follows the syntax rules set for PHP as detailed within date formats. Most ActiveCampaign date fields are properly formatted and will work. Default: The current date. Required: yes. |
format | The desired format for the returned date difference. All fractions of days are rounded down. Permissible Values: For days use d, for months and days use md, for years months and days use ymd, for seconds use U Default: d Required: no. |
Validity
This shortcode is evaluated for any type of visitor.
Conditional Branching
This shortcode does NOT support conditional branching with [ELSE_datediff].
Nesting
Shortcode nesting within is NOT supported.
Examples
- Example 1
- Example 2
- Example 3
- Example 4
- Example 5
Returns the date difference as 121 days:
[mbr_datediff from_date='20210901' to_date='20211231']
Returns the date difference as 4 months and 1 days:
[mbr_datediff from_date='20210901' to_date='20211231' format='md']
Returns the date difference as 1 year 4 months and 1 days:
[mbr_datediff from_date='20210901' to_date='20221231' format='ymd']
Returns the date difference as 10454400 seconds:
[mbr_datediff from_date='20210901' to_date='20211231' format='U']
Returns the date difference between the date value stored in the ActiveCampaign contact field my_custom_field_2 and the date value stored in the ActiveCampaign contact field my_custom_field_1 as days:
[mbr_datediff from_date='[mbr_db_my_custom_field_1]' to_date='[mbr_db_my_custom_field_2]']
API
There is currently no ActiveMember360 API function equivalent for this shortcode.