Daft Science by Coins

220px-parental_advisory_label-svgBeastie Boys Daft Punk Remixes by Coins. Awesome.

Number Suffixes in AMPScript

Suppose you want to output a day of the month with a proper suffix (e.g. 1st, 13th). There aren’t any formatting functions in AMPScript to do it, but you can do it with a set of if-statements:

Output

1st
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
11th
12th
13th
14th
15th
16th
17th
18th
19th
20th
21st
22nd
23rd
24th
25th
26th
27th
28th
29th
30th
31st

Once you’re satisfied that it works, you can simply remove the for-loop and un-comment the set @day = Format(Now(),"dd")) line

Reference

Lowest of 3 Numbers in AMPScript

Say you need to find the lowest of three numbers in an email — numbers you’ve retrieved from a Data Extension. Here’s one way to do it in AMPScript with a set of inline-if statements:

Output

num1: 105.54
num2: 88.73
num3: 106.32
lowestNum: 88.73

Reference