Date-time format and time zone
When rendering email messages, by default the API uses date-time format and time-zone based on system default settings. You can set your date-time format and set time-zone offset when rendering to HTML.
The following are the steps to set date-time and time zones for email message:
- Create HtmlViewOptions (or JpgViewOptions, or PngViewOptions, or PdfViewOptions) object
- If you want to set your date-time format - set EmailOptions.DateTimeFormat value
- If you want to set time zone offset for dates in E-Mail message TimeZoneOffset - set EmailOptions.TimeZoneOffset value
- Call View method.
The following code sample shows how to use custom date-time and a time-zone offset.
using (Viewer viewer = new Viewer("sample.eml"))
{
HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources("result_{0}.html");
viewOptions.EmailOptions.DateTimeFormat = "MM d yyyy HH:mm tt zzz";
// Time zone offset for 1 hour
viewOptions.EmailOptions.TimeZoneOffset = new TimeSpan(1, 0, 0);
viewer.View(viewOptions);
}
To get the full list of custom date-time formatting, please refer to these links:
Custom date and time format strings
Standard date and time format strings