cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp

Former Member
0 Kudos

Hi ,

I want the timestamp for a file in this format DDMMYY.

Please suggest and advise

Regards

Sai

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi SaiMadhu,

Use CurrentDate function and map that with the below UDF.

In the CurrentDate function, in properties define as ddMMyy.

public String TimeStamp(String a,Container container){ 
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key =
 DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String myFileName = "XXX"  +a+ ".txt " ;
conf.put(key, myFileName);
return "";
}

Here a is the input i.e the currentdate.

XXX- if you have any specific naming fixed to the filename. specify it over there.

Thanks,

former_member854360
Active Contributor
0 Kudos

You can use standard date function CURRENTDATE in graphical editor.

Double click on that function and select the format you want. in this case it will be ddMMyyyy.

filename-----------------------                    
                                                     concat-------------------UDF()---------Target root node.
Currentedate(ddMMYYYY)-------

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); 
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName"); 
 

conf.put(key, filename+".txt");
return "";

.

rajasekhar_reddy14
Active Contributor
0 Kudos

Please Search in sdn before postinng, this is very common requirement and answered N number of times

here is the code

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); 
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName"); 
 
SimpleDateFormat dateformat = new SimpleDateFormat("ddMMyyyy");
String timestamp = dateformat.format(new Date()); 
String newfilename=fileName+timestamp+".txt";
 
conf.put(key, newfilename);
return

write UDF and map this to root node select ASMA properties in receiver channel.

Regards,

Raj