Docs
You are viewing:
Product Catalog 2.0
Chargebee follows UTC and the dates are by default displayed in DD-MMM-YYYY format.
Example
An email template that has "Your trial period ends on subscription.trial_end
" will be displayed as "Your trial period ends on 23-Jan-2010" to your customers. The time here is in UTC and it is the standard format Chargebee uses to display date fields.
However, Chargebee provides you with the option to format the date and timezone in the desired email template using two mail merge attributes:
Note
The format and timezone mail merge attributes can only be used with date/timestamp fields.
Follow the steps below to navigate to the email templates and mail-merge fields:
You can now customize these mail merge fields according to the following scenarios and use them while editing your email templates.
If you want to display "Your trial period ends on 14 May 2016 11:07:00 UTC", use
subscription.trial_end | **format : dd MMM yyyy hh:mm:ss z**
If you want to display "Your trial period ends on 14-May-2016 03:07:00", use
subscription.trial_end | **timezone: PST**
If you want to display "Your trial period ends on 14-May-2016 03:07:00 PST", use
subscription.trial_end | **format : dd-MMM-yyy hh:mm:ss z | timezone: PST**
As you can see, when you specify the timezone (PST for example), the date and time are converted from UTC to PST and displayed in the email.
Here's a list of date/time formats that you can use along with the format attribute:
Date and Time Pattern | Result |
"yyyy-MM-dd G 'at' HH:mm:ss z" | 2001-07-04 AD at 12:08:56 UTC |
"EEE, MMM d, ''yy" |
<td>
<p>
Wed, Jul 4, '01
</p>
</td>
</tr>
<tr>
<td>
<p>
"h:mm a"
</p>
</td>
<td>
<p>
12:08 PM
</p>
</td>
"hh 'o''clock' a, zzzz"
12 o'clock PM, Coordinated Universal Time
"K:mm a, z"
0:08 PM, UTC
"yyyyy-MMMM-dd GGG hh:mm aaa"
02001-July-04 AD 12:08 PM
"EEE, d MMM yyyy HH:mm:ss Z"
Wed, 4 Jul 2001 12:08:56 -0700
"yyMMddHHmmssZ"
010704120856-0700
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
2001-07-04T12:08:56.235-0700
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
2001-07-04T12:08:56.235-07:00
"YYYY-'W'ww-u"
2001-W27-3
Note
This is not an exhaustive list of formats supported in Chargebee. You can experiment to find a format that works for you.
Letter | Date or Time Component | Presentation | Examples |
G | Era designator | AD | |
y | Year | 1996; 96 | |
Y | Week year | 2009; 09 | |
M | Month in year | July; Jul; 07 | |
w | Week in year | 27 | |
W | Week in month | 2 | |
D | Day in year | 189 | |
d | Day in month |
<td>
<p>
10
F
Day of week in month
<td>
<p>
2
E
Day name in week
<td>
<p>
Tuesday; Tue
<td>
<p>
1
<td>
<p>
PM
<td>
<p>
0
<td>
<p>
24
<td>
<p>
0
<td>
<p>
12
<td>
<p>
30
<td>
<p>
55
<td>
<p>
978
<td>
<p>
Coordinated Universal Time; UTC
Z
Time zone
<td>
<p>
+0000
<tr>
<td>
<p>
X
Time zone
<td>
<p>
+00; +0000; +00:00
Note
Formatting using dots is not supported. For example, "yyyy.MM.dd G 'at' HH:mm:ss z" is not supported, but you can format it as "yyyy-MM-dd G 'at' HH:mm:ss z" since dashes (-) are supported.
If you preview your email template, since the preview values are static, you will not be able to see the actual effect of the format and timezone attributes. You should save your template and test by generating an email.
We strongly recommend that you try template changes in your test site first before applying them to your live site.
Was this article helpful?