Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", tableA.date).substring(0,10) //to get string date:2009-04-28
TalendDate.formatDate("yyyy-MM-dd", tableB.date) //to get string date:2009-04-28
TalendDate.parseDate("yyyy-MM-dd","" + row1.table_a).
John/ Shong - could anyone of you please explain the function of ","" + row1.table_a portion in the code?
/**
* Parses text from the beginning of the given string to produce a date using the given pattern and the default date
* format symbols for the given locale. The method may not use the entire text of the given string.
* <p>
*
* @param pattern the pattern to parse.
* @param stringDate A <code>String</code> whose beginning should be parsed.
* @return A <code>Date</code> parsed from the string.
* @throws ParseException
* @exception ParseException if the beginning of the specified string cannot be parsed.
*
* {talendTypes} Date
*
* {Category} TalendDate
*
* {param} string("yyyy-MM-dd HH:mm:ss") pattern : the pattern to parse
*
* {param} string("") stringDate : A <code>String</code> whose beginning should be parsed
*
* {example} parseDate("yyyy-MMM-dd HH:mm:ss", "23-Mar-1979 23:59:59") #
*/
public synchronized static Date parseDate(String pattern, String stringDate) {
try {
return FastDateParser.getInstance(pattern).parse(stringDate);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}