Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to get system generated current date and push into a target table column (Please note - date is not coming from source but created a part of expression in tMap)
I am able to understand the error and hypothetically know its solution, but nothing seems to work. the target table accept date in DATE datatype. however, below expression in Talend creates date in string DATATYPE.
TalendDate.formatDate("MM-dd-yyyy",TalendDate.getCurrentDate())
as you see below, it gives error, however when i test, it gives proper date. I have also used several flavors of TalendDate.parseDate("MM-dd-yyyy",[fed the above expression here] but this too didnt work.)
I am posting the answer myself, problem was, when i was Testing the currentDate function as shown below, it was giving me String format as (SunFeb 06 19:51 EST...), however i just ignored it and went away by writing it in SQLServer target column, and the map ran fine, and in the target table date was showing fine in dd-MM-yyyy format,
beware, the format date function, shows the date in dd-MM-yyyy format, but thats actually string and it won't work.
Hi, TalendDate.formatDate return a String and you want a Date. So just use TalendDate.getCurrentDate() wich return a DATE
or if you want a specific date use for eg : TalendDate.parseDate("dd-MM-yyyy","31-01-2022")
Send me love and kudos
@guenneguez jeremy both these commands dont give date in date datatype.
TalendDate.getCurrentDate() --> gives result in string data type.
TalendDate.parseDate("dd-MM-yyyy",TalendDate.getCurrentDate()) --> this too didn't work.
I am posting the answer myself, problem was, when i was Testing the currentDate function as shown below, it was giving me String format as (SunFeb 06 19:51 EST...), however i just ignored it and went away by writing it in SQLServer target column, and the map ran fine, and in the target table date was showing fine in dd-MM-yyyy format,
beware, the format date function, shows the date in dd-MM-yyyy format, but thats actually string and it won't work.
TalendDate.getCurrentDate() return date,
TalendDate.parseDate("dd-MM-yyyy","31-01-2022") return date,
TalendDate.formatDate("dd-MM-yyyy",TalendDate.getCurrentDate()) return String