Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Please me on this below code. I have to change a date column to string type and the validate that whether it is valid date or not?
For validation it should come 0 or 1 a s output.
You have specified that you want to convert a date column to String and then validate whether its date. First of all, if the input column is having date data type, it will be always succeed in validation. So I assume your query is to check whether an input string is date or not. If has to give 1 as output if its a date value and 0 if its not a date value.
Please refer the below solution for this scenario.
The function is as shown below.
TalendDate.isDate(row1.data,"yyyy-MM-dd") ?"1":"0"
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
Convert String to Date :
TalendDate.parseDate("yyyy-MM-dd",Var.date_string )
Convert Int to Date :
TalendDate.parseDate("yyyyMMdd", Integer.toString(Var.date_int) )
Can you also please confirm how to check the null in the same syntax? using formatDate.