mbr_date
Usage
This shortcode returns a specified date formatted and modified as requested.
The specified date 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 |
---|---|
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. |
operation | Any text operator that follows the syntax rules as detailed for PHP strtotime(). This will modify the specified date. Default: none. Required: no. |
format | The desired format for the returned date. The format must follow the syntax rules set for PHP as detailed within date formats. Default: F jS, Y Required: no. |
Validity
This shortcode is evaluated for any type of visitor.
Conditional Branching
This shortcode does NOT support conditional branching with [ELSE_date].
Nesting
Shortcode nesting within is NOT supported.
Examples
- Example 1
- Example 2
- Example 3
- Example 4
Returns today's date formatted as per this example November 1st, 2021:
[mbr_date format='F jS, Y']
Returns the specified date as December 5th, 2020:
[mbr_date date='20201205123456' format='F jS, Y']
Returns the date as 2022-Mar-03:
[mbr_date date='20211203' operation='+3 months' format='Y-M-d']
Returns the date stored in the ActiveCampaign contact field my_custom_field with 3 months added to it in Ymd e.g. 20210403 format:
[mbr_date date='[mbr_db_my_custom_field]' operation='+3 months' format='Ymd']
API
For direct use in PHP code use the function mbr_date()
in a structure as illustrated here:
$my_date = mbr_date( array( 'date'=>'20091205123456', 'format'=>'F jS, Y', 'operation'=>'+3 months') );