If a timezone is detected inside the date time value, it is interpreted to convert and store this value in UTC format. By default, date values are also restituted at search time in UTC format.
There are however several methods to adjust the display of date time values to a specific timezone.
Specify a Timezone in the Output Format
The best method is to specify a default timezone output format for the date time meta (%Y-%m-%dT%H:%M:%S+00:00). This method allows you to get a complete date format that is easy to adjust to the web browser timezone settings.
1. Go to Search Logics > Hit Content.
2. Expand the date time meta and click Customize if it was generated by the Data Model.
3. Click Add operation to add a Time format operation.
4. Expand Time format and for Output format, enter a format including a timezone, for example, %Y-%m-%dT%H:%M:%S+00:00
5. Click Apply.
Convert Date Time Values to a Specific Timezone
The following procedures describe how to adjust the timezone server-side to match the end user’s timezone specified at query time. The goal of these procedures is to display date time values with the end user’s setting for both hit metas and facets.
To Adjust Date Time for Hit Metas
To adjust date time for hit metas, you need to use virtual field.
1. Go to Search Logics > Virtual Fields.
2. Add a new virtual field and give it a name, for example date_timezone_adjusted
3. Click Edit and in the Expression builder:
a. In Functions, double-click the #adjust_timezone function to insert it in the Expression field.
b. Place your cursor between the parentheses and in Index fields, and set how to adapt the time display.
Your expression must be: #adjust_timezone(<Name of date time field>)
4. Go to Search Logics > Hit Content.
5. Expand the date time meta and from Index field, select the virtual field you have created.
To Adjust Date Time for Facets
To adjust date time values for a date facet, you need to change its formula.
1. Go to Search Logics > Facets.
2. Expand your date facet, and click Edit next to the Expression field:
a. In Functions, double-click the #adjust_timezone function to insert it in the Expression field.
b. Place your cursor between the parentheses and from Index fields, double-click the index field impacted by the timezone adjustment.
Your expression must be: #adjust_timezone(<Name of date time field>)
To Adjust the Default Timezone
You finally have to adjust the default timezone.
1. Go to Search Logics > Locale Settings.
2. Specify the Default timezone that applies to all date values. This is calculated based on the difference with the UTC timezone.
3. Click Apply.
End users can now specify the timezone of their choice at search time. See Specify a Timezone at Search Time. This overrides the default timezone specified in step 2.
Specify a Timezone at Search Time
Once the server-side configuration is prepared to convert date time values, end users can specify the timezone of their choice at search time.
To Specify a Timezone at Search Time in the Search API
You can also specify a timezone as a query parameter to search for documents precisely.
1. In the Search API, use the timezone or tz parameter. For example, to adjust the timezone to UTC -01:30 (UTC being the default timezone), you can enter a query like: http://<HOSTNAME>:<BASEPORT+10>/search?q=%23all&tz=-01:30
To Specify a Timezone at Search Time with a UQL Prefix Handler
It is also possible to specify a timezone at search time when using Date prefix handlers.
1. For example, to get all documents created after 9:30AM on February 12, 2016, with a timezone of UTC -02:00, you can enter: date>=”Fri 12 Feb 2016 09:30:00 -02:00” or any other supported format between quotes.
How is the Timezone Handled in Mashup UI Applications?
When creating Mashup UI applications with the Mashup Builder, the user's browser timezone is automatically detected and sent to each query.
For more information, see the Cookie to parameter prerequest trigger description in "Add triggers to an application or a page" (in the Exalead CloudView Mashup Builder User's Guide).