Scriptlet: Custom Date/Timestamp

Use a scriptlet to return a custom date/timestamp. Page or advanced rules can be used to save the scriptlet result into a data collection field. The custom timestamp is available for data export and dynamic insertion on the page or in tracking script.

// returns mmddyyyyhhss
var d = new Date();
var formatD = String(d.getFullYear()) + fixL(String(d.getMonth() + 1)) + fixL(String(d.getDate())) + fixL(String(d.getHours())) + fixL(String(d.getMinutes())) + fixL(String(d.getSeconds()));
return formatD;
function fixL(s){
if (s.length == 1)
return "0" + s;
return s;