Transform map .

bandarunave
Tera Contributor

There is feild in staging table called created , which is in mutliple formats like GMT , IST etc..
before inserting the data into target table , need to change created on every record to IST
Can someone help how can i approach this one.

1 ACCEPTED SOLUTION

Pradeep Thipani
Mega Sage

Hi @bandarunave ,

 

You need to use a Transform Script for this. In the onBefore Script, check the source record’s timezone and then convert it into the required timezone before inserting into the target table.

 

Thanks,

Pradeep

 

 

View solution in original post

5 REPLIES 5

Shashank_Jain
Mega Sage

Hii @bandarunave ,

 

If you are moving data from a staging table to target table using a Transform Map, the right place to normalize the created field is in a Transform Script.

 

  • If only created field needs conversion → use a field transform script.

  • If multiple datetime fields → use an onBefore transform script for efficiency.

Giving you a logic I tried on PDI in background script to convert GMT timezone to IST -

 

var gmtDate = "2025-08-30 12:00:00 GMT";  // Sample GMT timezone

function convertToIST(rawDate) {
    var gdt = new GlideDateTime(rawDate); // GMT/UTC parse
    gdt.addSeconds(19800); // add 5 hrs 30 mins → IST
    return gdt.getDisplayValue();
}

gs.info("GMT Input : " + gmtDate + " | IST Output: " + convertToIST(gmtDate));

 

Hope it helps!