Skip to Main Content



For appeals, questions and feedback, please email

Converting date-Time from UTC to local time by providing the required time zone

HawkerHunterMar 9 2024

Hello friends,

I am currently working on an OIC integration and in the integration I am assigning current-dateTime() function to one of the target nodes in the mapper. But the current-dateTime() function returns the date time in UTC but I want the time in local time zone E.g.: in “Asia/Singapore”.

So I tried to create one JavaScript function and include it in the OIC Library and access that JavaScript function from the target node in the mapper.

In the JavaScript function I pass on current-dateTime() and “Asia/Singapore” as the UTC time and Time Zone.

My JavaScript Function is:

function getLocalTime(date, tzString){
var localDateTime = new Date((typeof date === "string" ? new Date(date) : date).toLocaleString("en-US", {timeZone: tzString}));

var returnString = localDateTime;
return returnString;


When I use this JavaScript function in any other editor like Visual Builder Code then it is returning the local time as expected but when I use it in OIC, it returns the same UTC time as the local time.

Can anyone please let me know where have I gone wrong or if anyone has implemented local time in OIC, I would appreciate your help.



Post Details
Added on Mar 9 2024