tamaki.mes.utils.convertTimezone
Description
Converts a date value to the specified timezone and returns it as a Date. Internally it formats the
value in the target timezone using formatDate and then parses the result back into
a Date. The timezone is resolved the same way as formatDate (explicit timezone, then the
session timezone from self, then Etc/UTC).
Returns None if value is None.
Syntax
tamaki.mes.utils.convertTimezone(value, self=None, timezone="Etc/UTC")
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
value | Number or Date | True | The date/time value to convert: milliseconds (int/long) or a java.util.Date. Returns None if None. |
self | Object | True | The component self, used to infer the session timezone when timezone is not provided. Defaults to None. |
timezone | String | True | An explicit timezone ID. Defaults to "Etc/UTC". |
Returns
A Date in the target timezone, or None if value is None.
Code Examples
# In a binding script transform: convert a date to the session (or explicit) timezone
return tamaki.mes.utils.convertTimezone(value)