i want to trunc() funtion on one of my columns in TMAP how do i call a routine on my col...
i mean is their any system routine which could handle this function........
Thanx in advance...
looking forward for a quick reply......
Hi,
The problem is after truncating the date ,using Format or SimpleDateFormat in java,returning that date make again concatination of 00:00:00.The above java code is returning string,in date case we required string to date conversion again........
The code mention below returns the date but with concatination of 00:00:00 by itself....
public Date returnDate(Date dateTime)
{
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("dd/MM/yyyy");
Format formatter=new SimpleDateFormat("dd/MM/yyyy");
String sample=formatter.format(dateTime);
try{
Date d=simpleDateFormat.parse(sample);
return d; //return date againwith hh:mm:ss concatination ,so no use of this function
}
catch (Exception e) {
e.printStackTrace();
}
return null;//as it is successful it will not return null ,it return d
If you want a Date object as your output but with the time set to midnight, you can do it yourself with TalendDate.parseDate("dd/MM/yyyy",TalendDate.formatDate("dd/MM/yyyy",row1.newColumn)). If you want a String object, you only need TalendDate.formatDate("dd-MM-yyyy",row1.newColumn). And if you only want to output your Date to a file in the right format, just set the Date Pattern of the output schema to "dd-MM-yyyy".