4.12.2012

TalendDate

Not a lot of examples around TalendDate so thought I'd post a couple of quick examples:

Today's date:
TalendDate.getDate("yyyy-MM-dd")
Returns:
2012-04-12

Yesterday's date:
TalendDate.addDate(TalendDate.getDate("yyyy-MM-dd"),"yyyy-MM-dd",-1,"dd")
Returns:
2012-04-11

Tomorrow's date:
TalendDate.addDate(TalendDate.getDate("yyyy-MM-dd"),"yyyy-MM-dd",1,"dd")
Returns:
2012-04-13

Date format:
CC - century
YY - year
MM - month
DD - day of month
hh - hour
mm - minutes
ss - seconds

Return types:
string!


Other methods:


TalendDate.compareDate(myDate,myDate2,"yyyy-MM-dd")
TalendDate.diffDate(myDate,myDate2,"MM")
TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",myDate)
TalendDate.setDate(mydate,newValue,"MM")
TalendDate.getFirstDayOfMonth(mydate)
TalendDate.getLastDayOfMonth(mydate)
TalendDate.getRandomDate("2007-01-01","2008-12-31")
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","")