AnsweredAssumed Answered

Convert Unix Date to Regular Date

Question asked by atul.gupta387556 on Dec 10, 2016
Latest reply on Dec 12, 2016 by Ramya_Nakkapalle

Wrote this Groovy Script. Passing unix date as Dynamic process property

 

import java.util.Properties;
import java.io.InputStream;
import com.boomi.execution.ExecutionUtil;
import java.text.SimpleDateFormat;
import java.util.Calendar;

 

long unixSeconds= ExecutionUtil.getDynamicProcessProperty(“UnixDate");
Date date = new Date(unixSeconds*1000L);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
sdf.setTimeZone(TimeZone.getDefault());
String FormattedDate = sdf.format(date);

ExecutionUtil.setDynamicProcessProperty("UnixDate, formattedDate, true");

 

 

getting this error message

 

Test execution of Test Unix date to Regular Date completed with errors. Embedded message: Error executing data process; Caused by: startup failed, Script372.groovy: 7: expecting anything but ''\n''; got it anyway @ line 7, column 71. 1 error (in groovy script); Caused by: startup failed, Script372.groovy: 7: expecting anything but ''\n''; got it anyway @ line 7, column 71. 1 error

 

 

Unable to figure out error as not using "\n" anywhere in the code. Not sure what is wrong. Need help

 

Thanks!

Outcomes