Date-time format and time zone setting when rendering E-Mail documents to HTML

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:

The following code sample shows how to use custom date-time and a time-zone offset.

    try (Viewer viewer = new Viewer("sample.eml")) {
        HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources("result_{0}.html");

        viewOptions.getEmailOptions().setDateTimeFormat("MM d yyyy HH:mm tt zzz");

        // Time zone offset for 1 hour


More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.