cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent issue in UDF

Former Member
0 Kudos

Hi Experts

I have the below UDF to set the date time stamp on the filename

String filename1    = "";

try {

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("yyyymmddHHmm");

String timestamp = dateformat.format(new Date());

if ( UseTimeStamp == "X" ) {

          filename1= Filenamepart + timestamp + "." + Fileextension;

}

else {

          filename1= Filenamepart + "." + Fileextension;

}

conf.put(key, filename1);

} catch(Exception ex){}

return filename1;

However a very weird observation is that in Development system the file name comes out correctly - with today's date but in Production system the file name is wrong - i.e filename in Development system is ABC201311081202.txt while in Production it is ABC201302081320.txt

I have an issue with the date being wrong - the 4 chars of time do not matter much.

Any help on this is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Girish,

SimpleDateFormat dateformat = new SimpleDateFormat("yyyymmddHHmm");

should be

SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm");

Regards,

Koen

Answers (3)

Answers (3)

former_member184681
Active Contributor
0 Kudos

Hi,

Your date format is not defined correctly, you should use "yyyyMMddHHmm" instead.

MM is for Month

mm is for minutes

Regards,

Greg

Former Member
0 Kudos
Former Member
0 Kudos

Hi Girish,

Check your PI system time once.  I think the system might be put as wrong.  UDF is taking PI system Current Date & Time.

Thanks,

Satish.