| Doc. Number | Article Title | Effective Date | Version |
| FHC-TAG-04 | How to Use Date, If Conditional, and Math Tags | November 02, 2026 | 0.5 |
This article describes DATE tags, Conditional ("If") Tags, and Math Tags. Each of these are described within each accordion section that is listed below:
DATE Tags
Overview
Date tags (Examples: {DATE}, {SIGNDATE}, {DOB}, etc.) populate information in the system default format, which is Month (abbreviated) Day, and Year (Example: Aug 02, 2024). Usually, this format is fine, but there may be cases where this format, or even the date, needs to be modified.
Common instances where the date format may be requested to be different:
- The client requests a specific format for a template (e.g., document, email, note, SMS, etc.).
- The client requests a future date, based on a defined date, to populate instead (Example: 3 Days in the Future from Today)
- An outside system that receives data from an account requires that a Webhook send dates in a specific format (Example: YYYY-MM-DD)
How to Format the {DATE} Tag
While the date codes used will depend on what you’re trying to do, formatting a date tag will start the same way.
For example, to change the format of my date to 'Day - Month (full spelling) - Year'.
Place the tag on the document template as {DATE:d - F - Y||today} to do this. The date would be "17 - April - 2024" (assuming today is April 17th, 2024).
The basic format being used is {DATE:**Date Code**||**date**}.
Populating future dates
You can also format date tags to have future dates populate automatically. For example, if you want the date to populate 10 days from today.
Place the tag on the document template as {DATE:m d, Y||Today + 10 days} to do this. The date would be "Apr 27, 2024" (assuming today is April 17, 2024).
Populating future dates related to other tags
You can also replace "Today" with another date tag. For example, if you have a tag labeled "Example Date", you can include this as part of the DATE tag, allowing you to populate the information in the desired format.
Let's assume you have a custom field, "Example Date," and it has a value of 1/12/2024 but you want it to populate as "January 1st, 2024", add the tag as {DATE:F jS, Y||{CF:Example Date}}. You are replacing "Today" as used in earlier examples for the tag {CF:Example Date}, this will then populate the value of Example Date as "January 1st, 2024".
Date codes
Below is a list of the available codes and an explanation of what they will populate. You will use these as part of the tag to format the populated information.
- d - The day of the month (from 01 to 31)
- D - A textual representation of a day (three letters)
- j - The day of the month without leading zeros (1 to 31)
- l (lowercase 'L') - A full textual representation of a day
- N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday)
- S - The English ordinal suffix for a day of the month (2 characters st, nd, rd or th. Works well with j)
- w - A numeric representation of the day (0 for Sunday, 6 for Saturday)
- z - The day of the year (from 0 through 365)
- W - The ISO-8601 week number of the year (weeks starting on Monday)
- F - A full textual representation of a month (January through December)
- m - A numeric representation of a month (from 01 to 12)
- M - A short textual representation of a month (three letters)
- n - A numeric representation of a month, without leading zeros (1 to 12)
- t - The number of days in the given month
- L - Whether it's a leap year (1 if it is a leap year, 0 otherwise)
- o - The ISO-8601 year number
- Y - A four-digit representation of a year
- y - A two-digit representation of a year
- a - Lowercase am or pm
- A - Uppercase AM or PM
- B - Swatch Internet time (000 to 999)
- g - 12-hour format of an hour (1 to 12)
- G - 24-hour format of an hour (0 to 23)
- h - 12-hour format of an hour (01 to 12)
- H - 24-hour format of an hour (00 to 23)
- i - Minutes with leading zeros (00 to 59)
- s - Seconds, with leading zeros (00 to 59)
- u - Microseconds (added in PHP 5.2.2)
- e - The timezone identifier (Examples: UTC, GMT, Atlantic/Azores)
- I (capital i) - Whether the date is in daylight savings time (1 if Daylight Savings Time, 0 otherwise)
- O - Difference to Greenwich time (GMT) in hours (Example: +0100)
- P - Difference to Greenwich time (GMT) in hours:minutes (added in PHP 5.1.3)
- T - Timezone abbreviations (Examples: EST, MDT)
- Z - Timezone offset in seconds. The offset for timezones west of UTC is negative (-43200 to 50400)
- c - The ISO-8601 date (e.g. 2013-05-05T16:34:42+00:00)
- r - The RFC 2822 formatted date (e.g. Fri, 12 Apr 2013 12:01:05 +0200)
- U - The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
Business date tag
It may be necessary to populate a future date in business days, omitting weekends and federal holidays from the calculation. A unique tag was developed for use in these cases.
For example, if you include a cancellation form in your contract that your client can sign and submit to cancel service within 10 business days of the Signing Date of your agreement, you would use the tag as displayed below to populate the date 10 business days in advance.
For example, assume the signing date is 4/17/2024 using the tag as {BDATE:M d, Y || 10 ||{DATE}} will populate the date 10 business days from that date which would be "Apr 29, 2024" (adhering to the formatted codes we used within the tag itself "M d, Y").
For additional information, visit php.net
Conditional ("If") Tags
Conditional ("If") Tags
The FORTH CRM allows you to perform conditional “if statements” in your documents using contact and program information nested inside of “if” tags. This can allow certain information to populate depending on if the qualifying criteria are true.
These conditional tags can use standard fields, custom fields, and can even be based on Math to detect if a statement is true or not. Use of these statements is paramount when it comes to building document templates, email templates, and even SMS templates, as it can often prevent multiple templates from needing to be created, instead just showing information, but only if certain criteria are true.
For example, an “if statement” could be used to call additional paragraphs if the client lives in a specific state, a different page if the client is paying via ACH Debit versus Credit Card, or even differing information depending on the client’s enrolled gateway. Without using conditional tags, all of these example scenarios would instead have required additional templates to be created to accomplish the same thing, which opens the door for user error if the wrong template were selected.
Please see the following table for different kinds of conditional statements and their uses:
Example Conditional Tags ("IF" statements)
| {if '{CF:Favorite Color}' = 'Red'}X{endif} | Populates "X" if the Favorite Color field is Red |
| {if '{CF:Favorite Color}' != 'Red'}X{endif} | Populates "X" if the Favorite Color field isn't Red |
| {if '{CF:Hardship Description}' ~= 'medical'}X{endif} | Populates "X" if the Hardship Description field includes the word medical |
| {if '{CF:Hardship Description}' ~== 'Medical'}X{endif} | Populates "X" if the Hardship Description field includes the word Medical (Case Sensitive) |
| {if '{CF:Hardship Description}' !~= 'medical'}X{endif} | Populates "X" if the Hardship Description field doesn't include the word medical |
| {if '{NUMDEBTS}' > '13'}14{endif} | Populates "14" if the number of enrolled debts is greater than 13 |
| {if '{NUMDEBTS}' < '13'}12{endif} | Populates "12" if the number of enrolled debts is less than 13 |
| {if '{CF:Holiday}' = 'Yes' && '{CF:Business Day}' = 'Yes'}X{endif} | Populates "X" if the Holiday field is Yes and the Business Day field is Yes |
| {if '{CF:Holiday}' = 'Yes' || '{CF:Business Day}' = 'Yes'}X{endif} | Populates "X" if the Holiday field is Yes or the Business Day field is Yes |
| {if '{CF:Favorite Color}' = 'Red'}X{else}Y{endif} | Populates "X" if the Favorite Color field is Red, otherwise populates "Y" |
| {if'{STATE}' = 'state_abbrev'} X {else} {if'{STATE}' = 'state_abbrev'} X {else} Y {endif} {endif} |
Populates "X" pending on what STATE equals to, otherwise populates "Y". Number of (endif) must equal number of IFs. Intended for multiples of similar parameters that have different X result but share similar Y result. |
NOTE: Whenever you are using "If" conditional statements, be sure to end every if with matching endif (see the table above for examples) or it can cause the information to display incorrectly.
Math Tags
Math Tags
The FORTH CRM also allows you to perform dynamic math calculations in your documents using contact and program information. These tags are extremely useful for auto-populating data into document templates, email templates, and SMS templates for those who use the SMS platform.
Three (3) types of Math tags can be used.
{MATH:} - does not round decimals: displays the exact result with decimal places
{MATHR:} - round to 2 decimal places: good for prices or percentages.
{MATHR0:} - removes trailing decimal places
Inside the Math tags, you can place numbers or other tags.
For example, if you wanted to show what the client pays in minimums per month.
Ex: {MATHR: ({TotalDebt} * .03)}
or if you wanted to display the total fee amount to the client.
Ex. {MATHR: {TotalDebt} * ({FEE1_PERCENT} / 100)}
NOTE: These tags do not return dollar or any other value sign, so use your dollar signs, etc. outside of the tags like: ${MATHR: **myformula**}
Article Version History:
| Version | Effective Date | Description |
| Basic | 12/26/2016 | Initial Release |
| 0.1 | 10/14/2022 | Added Header; Formatting updates - no subject matter updates |
| 0.2 | 10/23/2023 | Added Version Control Footer; no subject matter updates. |
| 0.3 | 11/06/2024 | Grammatical tweaks only; no subject matter updates. |
| 0.4 | 11/03/2025 | Added table of contents; made minor grammatical tweaks to improve comprehension. |
| 0.5 | 11/02/2026 | Merged article with "DATE Tags Formatting" article and made minor formatting adjustments. |
|
|
|
|
|
|
|
|