toTimeZone
Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center?Ā Click hereĀ !
Availability
This routine is available starting with katl-commons 2.5.6
Syntax
Ā toTimeZone(date, timeZone)
Description
Converts a date to the specified time zone.Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
date | date | Yes | Specifies the date to convert. |
timeZone | string | No | Specifies the time zone using a format compatible with TimeZone. See TimeZone for more details. |
Ā
Return type
date
Example
desc = ""; date d = toDate(2012, 01, 20, 0, 0, 0, 0, "GMT-8"); string format = "dd-MMM-yyyy HH:mm:ss Z"; desc += formatDate(d, format) + " converted to " + formatDate(toTimeZone(d, "GMT+2"), format);
Outputs to description:Ā 20-Jan-2012 00:00:00 -0800 converted to 20-Jan-2012 10:00:00 +0200
Example 2
desc = ""; date d = "2020-07-27T08:28:00+0300"; string format = "dd-MMM-yyyy HH:mm:ss Z"; desc += formatDate(d, format) + " converted to " + formatDate(toTimeZone(d, "GMT"), format);
Outputs to description:Ā 27-Jul-2020 08:28:00 +0300 converted to 27-Jul-2020 05:28:00 +0000
The date in example 2 must follow the formats listed for dateĀ here
See also
Ā