Ever wish you had more control over the date/time in your email templates?  Ever wish you could format a date and / or time in the ISN exactly how you want?

You can with the {dt} function in your email templates.  The function allows you to:

  • Modify the date/time results in your templates
  • Control the formatting of the output

Here is an example of the {dt} function in use:

{dt date="%inspectiondate%" modify="+6 Day" format="m/d/Y"}

You'll notice a few parameters:

date = the date (in this case inspection date (notice how I did have to wrap that in quotes))
modify = this is a statement of what to do w/ that date, in this case +6 days in the future
format = this is the format to display the date in

A few ideas:

"hey, I want to show the date in three days for radon pickup"

{dt date="%inspectiondate%" modify="+3 Day" format="m/d/Y"}

"hey, can I put two days before the inspection?"

{dt date="%inspectiondate%" modify="-2 Day" format="m/d/Y"}

"hey, I want to send an email and show the customer that they should attend 2 hours AFTER I start my inspection?"

{dt date="%inspectiontime%" modify="+2 Hour" format="g:iA"}

"hey, I want a space between my time and the AM / PM?"

{dt date="%inspectiontime%" modify="0 Hour" format="g:i A"}

Here are acceptable values for the date/time formats:

d  - Day of the month, 2 digits with leading zeros
D - A textual  representation of a day, three letters
j - Day of the  month without leading zeros
l (lowercase 'L') -  A full textual representation of the day of the week
N - ISO-8601  numeric representation of the day of the week
S - English  ordinal suffix for the day of the month, 2 characters
w - Numeric  representation of the day of the week
z - The day of the  year (starting from 0)
W - ISO-8601 week  number of year, weeks starting on Monday
F - A full textual  representation of a month, such as January or March
m
- Numeric  representation of a month, with leading zeros
M
- A short  textual representation of a month, three letters
n
- Numeric  representation of a month, without leading zeros
t
- Number of days  in the given month
L
- Whether it's a  leap year
o - ISO-8601 week-numbering year.
Y - A full numeric  representation of a year, 4 digits
y
- A two digit  representation of a year
a - Lowercase Ante  meridiem and Post meridiem
A - Uppercase Ante  meridiem and Post meridiem
B - Swatch  Internet time
g - 12-hour format  of an hour without leading zeros
G - 24-hour format  of an hour without leading zeros
h - 12-hour format  of an hour with leading zeros
H - 24-hour format  of an hour with leading zeros
i
- Minutes with  leading zeros
s - Seconds, with  leading zeros
c - ISO 8601 date
r - RFC  2822 formatted date

Did this answer your question?