Date Time Replacement In IFTTT with google script
IFTTT is good macro tool.
But OccuredAt format is not compatible with google datetime.
=TIMEVALUE(SUBSTITUTE("{{OccurredAt}}"," at ", " ")) + DATEVALUE(SUBSTITUTE("{{OccurredAt}}"," at ", " "))
Above is not working.
So, I write new custom function.
function dtr(myDate){
var vv = myDate;
vv = vv.toString();
var va = vv.split(" at ");
if(va[1]==undefined){
return;
}
var ampm = va[1].split(":");
if(va[1].substr(-2)=="PM"){
myDate = new Date((va[0].replace(",","")+", "+(parseInt(ampm[0],10)+12)+":"+ampm[1].substr(0,2)+":00"));
}else{
myDate = new Date((va[0].replace(",","")+", "+parseInt(ampm[0],10)+":"+ampm[1].substr(0,2)+":00"));
}
return myDate;
}
Create new script in spreadsheet.
Save script.
And you edit your IFTTT
=dtr("{{OccurredAt}}")
Check your Logs!