on 09-28-2016 10:32 AM
Hi Experts,
Dynamically fetching Source time stamp from SFTP sender adapter using ASMA. It's giving me EPOCH time stamp.
MTime | http://sap.com/xi/XI/System | 1475028600 |
Please help me to write UDF for converting this timestamp to Date GMT+1:00
Many Thanks
Hi Tapasya,
Use below UDF.
Execution Type: Single Values
public String epochToDate(String epoch, Container container) throws StreamTransformationException {
SimpleDateFormat dateFormat = new SimpleDateFormat();
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+1"));
return dateFormat.format(new Date(Long.parseLong(epoch)));
}
Test:
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tapasya,
I think your epoch time is seconds so we need to multiply by 1000 to get the mills seconds.
Use below UDF:
public String epochToDate(String epoch, Container container) throws StreamTransformationException {
SimpleDateFormat dateFormat = new SimpleDateFormat();
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+1"));
return dateFormat.format(new Date(Long.parseLong(epoch) * 1000));
}
Test:
Regards,
Praveen.
Hi Tapasya,
My requirement is to convert Idoc date and time to EPOCH.
Do we have any UDF available for this?
Thanks in Advance.
Regards,
Imran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.