To convert the time into the below format, we used this method for temporary fix.
Output required as : 2020-02-05 14:10:00 UTC
Output required as : 2020-02-05 14:10:00 UTC
Groovy script:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.util.TimeZone
def Message processData(Message message) {
//Body
def body = message.getBody();
//Properties
map = message.getProperties();
//LastSuccessfulRunTeleDev - variable value maintained in cpi system.
value = map.get("LastSuccessfulRunTeleDev");
def curDateTime1 = "";
def tz = TimeZone.getTimeZone("Europe/Berlin")
def ts = new Date()
curDateTime1 = (ts.format("yyyy-MM-dd HH:mm:ss", timezone=tz))
def datequery = "(CHANGE_DATE_TIME ge"+"'"+value+" UTC"+"'"+" and CHANGE_DATE_TIME le"+"'"+curDateTime1+" UTC"+"'"+")";
message.setHeader("datequery",datequery);
message.setProperty("CurrentDate",curDateTime1);
return message;
}
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.util.TimeZone
def Message processData(Message message) {
//Body
def body = message.getBody();
//Properties
map = message.getProperties();
//LastSuccessfulRunTeleDev - variable value maintained in cpi system.
value = map.get("LastSuccessfulRunTeleDev");
def curDateTime1 = "";
def tz = TimeZone.getTimeZone("Europe/Berlin")
def ts = new Date()
curDateTime1 = (ts.format("yyyy-MM-dd HH:mm:ss", timezone=tz))
def datequery = "(CHANGE_DATE_TIME ge"+"'"+value+" UTC"+"'"+" and CHANGE_DATE_TIME le"+"'"+curDateTime1+" UTC"+"'"+")";
message.setHeader("datequery",datequery);
message.setProperty("CurrentDate",curDateTime1);
return message;
}
No comments:
Post a Comment