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" | Wed, Jul 4, '01 |
"h:mm a" | 12:08 PM |
"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 | Text | AD |
y | Year | Year | 1996; 96 |
Y | Week year | Year | 2009; 09 |
M | Month in year | Month | July; Jul; 07 |
w | Week in year | Number | 27 |
W | Week in month | Number | 2 |
D | Day in year | Number | 189 |
d | Day in month | Number | 10 |
F | Day of week in month | Number | 2 |
E | Day name in week | Text | Tuesday; Tue |
u | Day number of week (1 = Monday, ..., 7 = Sunday) | Number | 1 |
a | am/pm marker | Text | PM |
H | Hour in day (0-23) | Number | 0 |
k | Hour in day (1-24) | Number | 24 |
K | Hour in am/pm (0-11) | Number | 0 |
h | Hour in am/pm (1-12) | Number | 12 |
m | Minute in hour | Number | 30 |
s | Second in minute | Number | 55 |
S | Millisecond | Number | 978 |
z | Time zone | General time zone | Coordinated Universal Time; UTC |
Z | Time zone | RFC 822 time zone | +0000 |
X | Time zone | ISO 8601 time zone | +00; +0000; +00:00 |
Note
Was this article helpful?