2009-03-08T02:28:03.000Zdate seems to be an invalid date when we validates this data in WM 6.5 by the use of simpleDateTimeFormat class.Somehow the date and the time together seem to be a valid date time and hence WM throws this as a validation exception for the invalid date time format with the error message below
At this point,Iam not really sure of why its considered as an invalid date time as other date timestamp pass the date validation.
The below logic worked when we tried in EClipse.But when we tried the below code in WM 6.5., we got exception.Please help me on this.
date : 2009-03-08T02:28:03.000Z
format : yyyy-MM-dd’T’HH:mm:ss
Code :
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String date = IDataUtil.getString( pipelineCursor, “date” );
String format = IDataUtil.getString( pipelineCursor, “format” );
pipelineCursor.destroy();
String isValidDate = “true”;
try
{
if (format == null)
throw new ServiceException(“Unable to validate date. The format is not specified.”);
if (date!= null && date.trim().length() != 0)
{
SimpleDateFormat df = new SimpleDateFormat(format);
df.setLenient(false);
Date d = df.parse(date);
}
}
catch (Exception e) {
isValidDate = “false”;
}
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “isValidDate”, isValidDate );
pipelineCursor_1.destroy();