cancel
Showing results for 
Search instead for 
Did you mean: 

Need Time stamp like yyyymmddThhmmssGMT

Former Member
0 Kudos

Hi Friends,

i am doing file to file scenario.

i am getting file with time stamp as 20081020-062614-501.txt.

But i want Time stamp as yyyymmddThhmmssGMT.txt.

please give me replies.

Thanks

Anil M

Accepted Solutions (0)

Answers (2)

Answers (2)

prasad_ulagappan2
Contributor
0 Kudos

You can do it with dynamic configuration option in UDF. Inside UDF, you can get the file name as it is, then change the file name as per your format.

former_member183906
Active Contributor
0 Kudos

Hii

You can solve this by using dynamic configuration.

Please follow the below blog for reference.

Implement the below code to achieve the same.

Create UDF with Date(pre-defined function) as input parameter.

Map the UDF to the root node level of the target message.

//Get Current time

Calendar cal =new GregorianCalendar();

int hour = cal.get(Calendar.HOUR);

if(cal.get(Calendar.AM_PM) != 0)

hour+=12;

int min=cal.get(Calendar.MINUTE);

int sec=cal.get(Calendar.SECOND);

String cur_time=hour""min""sec;

//Get Input Date in the reqd format

String Datetime= Date+""cur_time"GMT";

//I hope file name is constant

String Filename ="ABC";

String extension =".txt"

String dynaname = FilenameDatetimeextension

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(

“http://sap.com/xi/XI/System/File”,

“FileName”);

conf.put(key,dynaname);

return "";

Rgds