Hi Lazim,
I have some old code from a while ago that I reuse.
Start by extracting your OriginalDate and setting the field to type Date and format as dd M yyyy.
In another Extact Step add a new field set to JavaScript. (Or add another JavaScript field to your currect extract step.) Name the field accordingly and add the following code:
var aDate = data.extract(1,16,0,1,"<br />").split(" ");
var arrMonths = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var fullDate;
var pad = "00";
var m = arrMonths.indexOf(aDate[1]) + 1;
m = m.toFixed(0)
var paddedM = pad.substring(0, pad.length - m.length) + m;
fullDate = aDate[0] + "/" + paddedM + "/" + aDate[2];
*Note that I am using text data as sample data, so in the above script I’m splitting the date using space as delimiter: data.extract(1,16,0,1,"<br />").split(" ");
Adjust this code based on your data mapper data type.
This should return “30/08/1999” from your sample data of “30 August 1999”.
In another field add the following JavaScript: (Note the field called OriginalData in the below code, it references the original field name from your first extraction.)
var myDate = record.fields.OriginalDate;
//Add or minus days here.
var newDate = myDate.setDate(myDate.getDate() + 20);
//Convert milliseconds to date.
var date = new Date(newDate);
date;
Set this field as:
You can edit “+ 20” above to add or minus days from your date.
Now in your template you can add this field and simply format it to “Long Date”
Regards,
S