This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Date Part Logic | |
| * Used to isolate specific elements of a date object. | |
| */ | |
| VAR @date, @date_day, @date_month, @date_year, @date_minutes, @date_hours | |
| SET @date = "12/14/2021 9:30:00 AM" | |
| SET @date_day = DatePart(@date,"d") | |
| SET @date_month = DatePart(@date,"m") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Date Parse Logic | |
| * Used to convert a string into a DateTime object. | |
| * Date might be provided as a string in the incorect format so DateParse() converts it into a DateTime object in the proper format. | |
| */ | |
| VAR @date1, @date2, @date3, @date4, @date5 | |
| SET @date1 = DateParse("12/14/2021 9:00:00 AM") | |
| SET @date2 = DateParse("December 14, 2017 3:40PM",1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Date Diff Logic | |
| * Used to return the difference between two date values. | |
| * Always use the DateDiff() when comparing DateTime values otherwise they will be compared as strings. | |
| */ | |
| VAR @date1, @date2, @dateDiff_Days, @dateDiff_Months, @dateDiff_Years, @dateDiff_Minutes, @dateDiff_Hours | |
| SET @date1 = "12/14/2021 9:00:00 AM" | |
| SET @date2 = "12/14/2022 9:00:00 AM" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Date Add Logic | |
| * Used to increase or decrease date values. | |
| */ | |
| VAR @initialDate, @previousDay, @nextDay, @nextMonth, @nextMinute, @nextHour | |
| SET @initialDate = "12/14/2021 9:00:00 AM" | |
| SET @previousDay = DateAdd(@initialDate,"-1","d") /* Decreases by one day */ | |
| SET @nextDay = DateAdd(@initialDate,"1","d") /* Increases by one day */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Now Logic (Triggered Send Workaround) | |
| * Using Now(1) in a triggered send returns the latest TSD published time. | |
| * Add a date field to your triggered DE and name it something like DateAdded. | |
| * Add a default value that auto-populates that new field with current date. | |
| * This captures the date/time the subscriber was added to the triggered DE. | |
| * Use a simple lookup that returns the DateAdded for that subscriber. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Now Logic | |
| * Used to generate a dynamic date at the time of send | |
| */ | |
| VAR @date | |
| SET @date = Now(1) | |
| ]%% | |
| <p>%%=v(@date)=%%</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Subtract Logic | |
| * The Subtract() is used to subtract two numeric constants. | |
| */ | |
| VAR @number1, @number2, @results | |
| SET @number1 = 2 | |
| SET @number2 = 1 | |
| SET @results = Subtract(@number1,@number2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Multiply Logic | |
| * The Multiply() is used to multiply two numeric constants. | |
| */ | |
| VAR @number1, @number2, @results | |
| SET @number1 = 2 | |
| SET @number2 = 2 | |
| SET @results = Multiply(@number1,@number2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Mod Logic | |
| * The Mod() is used to find the remainder between two numeric constants. | |
| */ | |
| VAR @number1, @number2, @results | |
| SET @number1 = 10 | |
| SET @number2 = 4 | |
| SET @results = Mod(@number1,@number2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Example Code --> | |
| %%[ | |
| /** | |
| * Divide Logic | |
| * The Divide() is used to divide two numeric constants. | |
| */ | |
| VAR @number1, @number2, @results | |
| SET @number1 = 10 | |
| SET @number2 = 5 | |
| SET @results = Divide(@number1,@number2) |