Take 2 strings, input as 'Date' and output as 'Day'
public static final void GetDayfromDate(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String dat = IDataUtil.getString(pipelineCursor, "Date");
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
try {
Date dt1 = format.parse(dat);
DateFormat format2=new SimpleDateFormat("EEEE");
String finalDay=format2.format(dt1);
IDataUtil.put(pipelineCursor, "day", finalDay);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
input:--- 22/04/2011
outpu:---- Friday
public static final void GetDayfromDate(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String dat = IDataUtil.getString(pipelineCursor, "Date");
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
try {
Date dt1 = format.parse(dat);
DateFormat format2=new SimpleDateFormat("EEEE");
String finalDay=format2.format(dt1);
IDataUtil.put(pipelineCursor, "day", finalDay);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
input:--- 22/04/2011
outpu:---- Friday
No comments:
Post a Comment