Skip to main content

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

ParametersDescription
from_dateThe 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_dateThe 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.
formatThe 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

Returns the date difference as 121 days:

[mbr_datediff from_date='20210901' to_date='20211231']

API

info

There is currently no ActiveMember360 API function equivalent for this shortcode.