- 1 Minute to read
- Print
- DarkLight
ecx:fmtDateInTimeZone
- 1 Minute to read
- Print
- DarkLight
The function ecx:fmtDateInTimeZone interprets a given date in the specified source time zone. It then sets the specified target time zone on the date but retains the date and time fields as they were on the original date. The date is formatted as a string with the given pattern and locale. The value returned is a string data type.
Example
The purchase date is stored in the custom attribute user.CustomAttribute['PurchaseDate']. The function to convert this value to Sydney time is constructed as follows:
${ecx:fmtDateInTimezone(user.CustomAttribute['PurchaseDate'], null, 'Australia/Sydney', 'yyyy-MM-dd HH:mm:ssZ', 'en')}
If the attribute value is 2013-09-08T02:00:00+0200 (midnight at UTC time), the output is 2013-09-08T00:00:00+1000.
Structure
ecx:fmtDateInTimeZone(date, string, string, string, string)
Parameters
Parameter | Description |
---|---|
date | Specifies the target value to format. If the value used for this parameter is a string data type, it must be converted to a date data type with the function ecm:toDate. |
string | Specifies the source time zone. If no source time zone is specified, UTC+00:00 is used as default. |
string | Specifies the target time zone. |
string | Specifies the date format. A list of possible date patterns is available here: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html. The parameter also recognizes the values 'date', 'shortdate', 'time', 'datetimesec', 'datetime', 'shortdatetime', 'xlsdate', 'xlsdatetime', 'iso8601date' and 'iso8601datetime'. The output format is further refined by the variable localeCode. |
string | Variable localeCode, applies a country-specific format to the date according to the ISO language code used. |