Skip to Content

How to read SFTP server time `

Jul 03, 2017 at 12:31 PM


avatar image

Dear All.

I would like to read the SFTP server time stamp and the same time to be posted in the Dadabase. my scenario is SFTP to JDBC. and i can see "Time Stamp" parameter in ASMA in sender adapter.

now how to get the server time stamp into my field. please do let me know is any UDF available for the same.

please note: if i enable the "timestamp" in sender SFTP channel by enabling ASAM , i can see "MTime" as i mentioned below.

<sap:Record namespace="" name="MTime">1499083669</sap:Record>

in this case, is there any way to convert Mtime to DateTime format.

please do needful.



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Evgeniy Kolmakov Jul 03, 2017 at 01:10 PM

Hi K Ramesh!

public static String getDateFromUnixTimeStamp(long timeStamp, String dateFormat, String timeZone) {
if (timeStamp == 0)
return "";
if (dateFormat == null || dateFormat.trim().isEmpty())
dateFormat = "yyyy-MM-dd HH:mm:ss";

Date date = new Date(timeStamp*1000L);
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
if (!(timeZone == null || timeZone.trim().isEmpty()))

return sdf.format(date);

Regards, Evgeniy.

10 |10000 characters needed characters left characters exceeded